projects
/
tools.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
round:output without comma for integer targets
[tools.git]
/
tools
/
freq_measure.c
1
#include <stdio.h>
2
#include <sys/time.h>
3
#include <sched.h>
4
5
long getms(void) {
6
struct timeval t;
7
gettimeofday(&t, NULL);
8
return t.tv_sec * 1024 + t.tv_usec/1024;
9
}
10
11
int main(void) {
12
setbuf(stdout, NULL);
13
while (1) {
14
int c = 0;
15
long t0 = getms();
16
do {
17
c++;
18
sched_yield();
19
} while (getms()<t0+10);
20
printf("%d\n", c);
21
}
22
}