summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-10-01 17:59:26 +0000
committerRoland McGrath <roland@gnu.org>1999-10-01 17:59:26 +0000
commit7a540261e923915a4708fc2c60a02055ccef9872 (patch)
tree42a7c7e303efc12a327e91686f8de0a909cc8f9b /benchmarks
parentd17b3d7969cd35fcc50f3ecac7b2b39612bfc018 (diff)
1999-10-01 Roland McGrath <roland@baalperazim.frob.com>
* forks.c: Add #include's to silence implicit decl warnings (main): Use time_t and add a cast, to silence type warnings.
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/forks.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/benchmarks/forks.c b/benchmarks/forks.c
index 1043e124..30f01f72 100644
--- a/benchmarks/forks.c
+++ b/benchmarks/forks.c
@@ -1,5 +1,11 @@
/* From 4.4 BSD sys/tests/benchmarks/forks.c. */
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <sys/wait.h>
+
/*
* Benchmark program to calculate fork+wait
* overhead (approximately). Process
@@ -8,13 +14,14 @@
* in calculating exec overhead.
*/
+int
main(argc, argv)
char *argv[];
{
register int nforks, i;
char *cp;
int pid, child, status, brksize;
- int starttime, endtime;
+ time_t starttime, endtime;
if (argc < 3) {
printf("usage: %s number-of-forks sbrk-size\n", argv[0]);
@@ -30,7 +37,7 @@ main(argc, argv)
printf("%s: bad size to sbrk\n", argv[2]);
exit(3);
}
-
+
time (&starttime);
cp = (char *)sbrk(brksize);
if ((int)cp == -1) {
@@ -51,6 +58,6 @@ main(argc, argv)
;
}
time (&endtime);
- printf ("Time: %d seconds.\n", endtime - starttime);
+ printf ("Time: %d seconds.\n", (int) (endtime - starttime));
exit(0);
}