1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00
sortix--sortix/bench/benchsyscall.cpp

15 lines
365 B
C++
Raw Normal View History

#include <stdio.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
uintmax_t start;
if ( uptime(&start) ) { perror("uptime"); return 1; }
uintmax_t end = start + 1ULL * 1000ULL * 1000ULL; // 1 second
size_t count = 0;
uintmax_t now;
while ( !uptime(&now) && now < end ) { count++; }
printf("Made %zu system calls in 1 second\n", count);
return 0;
}