Skip to content

Instantly share code, notes, and snippets.

@mabj
Created January 13, 2020 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mabj/459e8611560bbb8b012e0e7f1967dc9c to your computer and use it in GitHub Desktop.
Save mabj/459e8611560bbb8b012e0e7f1967dc9c to your computer and use it in GitHub Desktop.
#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