kernel: scheduling fix for ARM
[minix.git] / benchmarks / unixbench-5.1.2 / src / pipe.c
blob4374e280fdb52f3b1c66d38a978e9ac193b6d152
1 /*******************************************************************************
2 * The BYTE UNIX Benchmarks - Release 3
3 * Module: pipe.c SID: 3.3 5/15/91 19:30:20
5 *******************************************************************************
6 * Bug reports, patches, comments, suggestions should be sent to:
8 * Ben Smith, Rick Grehan or Tom Yager
9 * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
11 *******************************************************************************
12 * Modification Log:
13 * $Header: pipe.c,v 3.5 87/06/22 14:32:36 kjmcdonell Beta $
14 * August 29, 1990 - modified timing routines (ty)
15 * October 22, 1997 - code cleanup to remove ANSI C compiler warnings
16 * Andy Kahn <kahn@zk3.dec.com>
18 ******************************************************************************/
19 char SCCSid[] = "@(#) @(#)pipe.c:3.3 -- 5/15/91 19:30:20";
21 * pipe -- test single process pipe throughput (no context switching)
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <errno.h>
28 #include "timeit.c"
30 unsigned long iter;
32 void report(int sig)
34 fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
35 exit(0);
38 int main(int argc, char *argv[])
40 char buf[512];
41 int pvec[2], duration;
43 if (argc != 2) {
44 fprintf(stderr,"Usage: %s duration\n", argv[0]);
45 exit(1);
48 duration = atoi(argv[1]);
50 pipe(pvec);
52 wake_me(duration, report);
53 iter = 0;
55 while (1) {
56 if (write(pvec[1], buf, sizeof(buf)) != sizeof(buf)) {
57 if ((errno != EINTR) && (errno != 0))
58 fprintf(stderr,"write failed, error %d\n", errno);
60 if (read(pvec[0], buf, sizeof(buf)) != sizeof(buf)) {
61 if ((errno != EINTR) && (errno != 0))
62 fprintf(stderr,"read failed, error %d\n", errno);
64 iter++;