summaryrefslogtreecommitdiff
path: root/src/bin/speed.c
blob: 9fd373e5c68204c6fa4df4e326e0a653679ef275 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <unistd.h>
#include <stdio.h>
#include <signal.h>

int count;

void printandreset(int sig) {
 alarm(1);
 printf("persecond: %d\n",count);
 count=0;
}

int main(int argc,char *argv[]) {
 char in[256];
 count=0;
 signal(SIGALRM,printandreset);
 alarm(1);
 while(fgets(in,256,stdin)) {
  count++;
 }
 return 0;
}