Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#define _WIN32_WINNT 0x0501
#define _GLIBCXX_USE_C99 1
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <iostream>
#include <string>
#include <sstream>
#define ITERATION 1500000
#define DELAY 2000 // miliseconds
void execute_calls();
int main(int argc, char argv[]) {
int i = ITERATION;
if (argc == 2) {
std::istringstream ss(argv[1]);
ss >> i;
}
printf("Doing %d iterations through syscalls\n", i);
Sleep(1000);
while (i--) {
execute_calls();
Sleep(DELAY);
}
return 0;
}
void execute_calls() {
_SYSTEM_INFO sysinfo;
GetNativeSystemInfo(&sysinfo);
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
GlobalMemoryStatusEx(&status);
CPINFO cpinfo;
bool succeeded = GetCPInfo(437, &cpinfo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment