home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
pc
/
source
/
byteunix.lzh
/
byte.1
/
pipe.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-11
|
1KB
|
42 lines
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 2
* Module: pipe.c SID: 2.4 4/17/90 16:45:35
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith or Rick Grehan at BYTE Magazine
* bensmith@bixpb.UUCP rick_g@bixpb.UUCP
*
*******************************************************************************
* Modification Log:
* $Header: pipe.c,v 3.5 87/06/22 14:32:36 kjmcdonell Beta $
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)pipe.c:2.4 -- 4/17/90 16:45:35";
/*
* pipe -- test single process pipe throughput (no context switching)
*
*/
main(argc, argv)
int argc;
char *argv[];
{
char buf[512];
int iter = 2048; /* 1M byte */
int pvec[2];
pipe(pvec);
close(0); dup(pvec[0]); close(pvec[0]);
close(1); dup(pvec[1]); close(pvec[1]);
while (iter-- > 0) {
if (write(1, buf, sizeof(buf)) != sizeof(buf))
perror("write failed");
if (read(0, buf, sizeof(buf)) != sizeof(buf))
perror("read failed");
}
exit(0);
}