Remove the RCSID macro
[openafs.git] / src / lwp / test / test.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13
14 #include <stdio.h>
15 #include <sys/time.h>
16 #include <potpourri.h>
17 #include "lwp.h"
18
19 char semaphore;
20
21 int
22 OtherProcess()
23 {
24     for (;;) {
25         LWP_SignalProcess(&semaphore);
26     }
27 }
28
29 main(argc, argv)
30      int argc;
31      char *argv[];
32 {
33     struct timeval t1, t2;
34     int pid, otherpid;
35     register int i, count, x;
36     char *waitarray[2];
37     static char c[] = "OtherProcess";
38
39     count = atoi(argv[1]);
40
41     assert(LWP_InitializeProcessSupport(0, (PROCESS *) & pid) == LWP_SUCCESS);
42     assert(LWP_CreateProcess
43            (OtherProcess, 4096, 0, 0, c,
44             (PROCESS *) & otherpid) == LWP_SUCCESS);
45
46     waitarray[0] = &semaphore;
47     waitarray[1] = 0;
48     gettimeofday(&t1, NULL);
49     for (i = 0; i < count; i++) {
50         LWP_MwaitProcess(1, waitarray, 1);
51     }
52     gettimeofday(&t2, NULL);
53
54     x = (t2.tv_sec - t1.tv_sec) * 1000000 + (t2.tv_usec - t1.tv_usec);
55     printf("%d milliseconds for %d MWaits (%f usec per Mwait and Signal)\n",
56            x / 1000, count, (float)(x / count));
57 }