|
|
1.1 ! root 1: /* ! 2: * Signal without context switch benchmark. ! 3: */ ! 4: #include <signal.h> ! 5: ! 6: int pid; ! 7: int nsigs; ! 8: int sigsub(); ! 9: ! 10: main(argc, argv) ! 11: char *argv[]; ! 12: { ! 13: ! 14: if (argc < 2) { ! 15: printf("usage: %s nsignals\n", argv[0]); ! 16: exit(1); ! 17: } ! 18: nsigs = atoi(argv[1]); ! 19: signal(SIGALRM, sigsub); ! 20: pid = getpid(); ! 21: kill(pid, SIGALRM); ! 22: } ! 23: ! 24: sigsub() ! 25: { ! 26: static int i = 0; ! 27: ! 28: signal(SIGALRM, sigsub); ! 29: if (i++ < nsigs) ! 30: kill(pid, SIGALRM); ! 31: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.