git.samba.org
/
tridge
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
useful script on bladecenters
[tridge/junkcode.git]
/
sigspeed.c
1
#include <stdio.h>
2
#include <unistd.h>
3
#include <signal.h>
4
#include <errno.h>
5
#include <stdlib.h>
6
7
static int count;
8
static pid_t pid;
9
10
static void sigusr1(int num)
11
{
12
count++;
13
kill(pid, SIGUSR1);
14
if (count % 1000000 == 0) {
15
printf("%d\r", count);
16
fflush(stdout);
17
}
18
if (count == 10000000) {
19
exit(1);
20
}
21
}
22
23
int main(int argc, char *argv[])
24
{
25
pid = getpid();
26
signal(SIGUSR1, sigusr1);
27
while (1) {
28
kill(pid, SIGUSR1);
29
pause();
30
}
31
return 0;
32
}