X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Flwp%2Ftest%2Ftest.c;h=f5e11515e13dfb6b2038ca2dab5e7c3be110f2df;hp=c9d50fdaabde47d71208d9374d78bde2f6fa1cde;hb=38fc16ddbf1e5477050db21c94d55f75bdadf80b;hpb=87c10e8d7f05dbbdf12ee9e8651dcec07e08af3f diff --git a/src/lwp/test/test.c b/src/lwp/test/test.c index c9d50fd..f5e1151 100644 --- a/src/lwp/test/test.c +++ b/src/lwp/test/test.c @@ -1,62 +1,56 @@ /* -**************************************************************************** -* Copyright IBM Corporation 1988, 1989 - All Rights Reserved * -* * -* Permission to use, copy, modify, and distribute this software and its * -* documentation for any purpose and without fee is hereby granted, * -* provided that the above copyright notice appear in all copies and * -* that both that copyright notice and this permission notice appear in * -* supporting documentation, and that the name of IBM not be used in * -* advertising or publicity pertaining to distribution of the software * -* without specific, written prior permission. * -* * -* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM * -* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * -* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * -* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * -* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -**************************************************************************** -*/ + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#include +#include + #include #include -#include #include "lwp.h" char semaphore; -int OtherProcess() - { - for(;;) - { +int +OtherProcess() +{ + for (;;) { LWP_SignalProcess(&semaphore); - } } +} main(argc, argv) -int argc; char *argv[]; - { + int argc; + char *argv[]; +{ struct timeval t1, t2; int pid, otherpid; - register int i, count, x; + int i, count, x; char *waitarray[2]; static char c[] = "OtherProcess"; - + count = atoi(argv[1]); - assert(LWP_InitializeProcessSupport(0, &pid) == LWP_SUCCESS); - assert(LWP_CreateProcess(OtherProcess,4096,0, 0, c, &otherpid) == LWP_SUCCESS); + assert(LWP_InitializeProcessSupport(0, (PROCESS *) & pid) == LWP_SUCCESS); + assert(LWP_CreateProcess + (OtherProcess, 4096, 0, 0, c, + (PROCESS *) & otherpid) == LWP_SUCCESS); waitarray[0] = &semaphore; waitarray[1] = 0; gettimeofday(&t1, NULL); - for (i = 0; i < count; i++) - { + for (i = 0; i < count; i++) { LWP_MwaitProcess(1, waitarray, 1); - } + } gettimeofday(&t2, NULL); - x = (t2.tv_sec -t1.tv_sec)*1000000 + (t2.tv_usec - t1.tv_usec); - printf("%d milliseconds for %d MWaits (%f usec per Mwait and Signal)\n", x/1000, count, (float)(x/count)); - } + x = (t2.tv_sec - t1.tv_sec) * 1000000 + (t2.tv_usec - t1.tv_usec); + printf("%d milliseconds for %d MWaits (%f usec per Mwait and Signal)\n", + x / 1000, count, (float)(x / count)); +}