summaryrefslogtreecommitdiff
path: root/benchmarks/forks.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/forks.c')
-rw-r--r--benchmarks/forks.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/benchmarks/forks.c b/benchmarks/forks.c
index ae9efaab..2bb98a88 100644
--- a/benchmarks/forks.c
+++ b/benchmarks/forks.c
@@ -14,6 +14,7 @@ main(argc, argv)
register int nforks, i;
char *cp;
int pid, child, status, brksize;
+ int starttime, endtime;
if (argc < 2) {
printf("usage: %s number-of-forks sbrk-size\n", argv[0]);
@@ -29,6 +30,8 @@ main(argc, argv)
printf("%s: bad size to sbrk\n", argv[2]);
exit(3);
}
+
+ time (&starttime);
cp = (char *)sbrk(brksize);
if ((int)cp == -1) {
perror("sbrk");
@@ -47,5 +50,7 @@ main(argc, argv)
while ((pid = wait(&status)) != -1 && pid != child)
;
}
+ time (&endtime);
+ printf ("Time: %d seconds.\n", endtime - starttime);
exit(0);
}