summaryrefslogtreecommitdiffstats
path: root/runtime/bench2/itest.c
diff options
context:
space:
mode:
authorhunt <hunt>2006-03-26 22:47:10 +0000
committerhunt <hunt>2006-03-26 22:47:10 +0000
commit7817aecdf972b7f3202d386ae97f2e77663261b9 (patch)
treee52946889e046a0e412e08cdff368cc5b9924502 /runtime/bench2/itest.c
parent91a86037758d6a1275c78d96021664fc0ab72da2 (diff)
downloadsystemtap-steved-7817aecdf972b7f3202d386ae97f2e77663261b9.tar.gz
systemtap-steved-7817aecdf972b7f3202d386ae97f2e77663261b9.tar.xz
systemtap-steved-7817aecdf972b7f3202d386ae97f2e77663261b9.zip
2006-03-26 Martin Hunt <hunt@redhat.com>
* bench2/bench.rb (Bench::run): Instead of loading the module once and running against different numbers of threads, load and unload the module each time. Then keep track of failures per thread. Also use the new itest to keep the tests the same size regardless of the number of threads. (Bench::initialize): Make itest if needed. (Bench::load, Stapbench::load): Increase buffer size to 8MB. * bench2/itest.c: Change arg to be the number of threads instead of the number of millions of calls to make. This makes it easy to divide the work among multiple threads without making the test run many times longer.
Diffstat (limited to 'runtime/bench2/itest.c')
-rw-r--r--runtime/bench2/itest.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/runtime/bench2/itest.c b/runtime/bench2/itest.c
index dc385567..efba623a 100644
--- a/runtime/bench2/itest.c
+++ b/runtime/bench2/itest.c
@@ -28,7 +28,7 @@ uint64 stop()
void usage(char *name)
{
- printf ("Usage %s [time]\nWhere \"time\" is millions of times to loop.\n", name);
+ printf ("Usage %s [num_threads]\nitest will call sys_getuid() 1000000/num_threads times.\n", name);
exit(1);
}
@@ -42,16 +42,15 @@ int main(int argc, char *argv[])
if (argc == 2) {
n = strtol(argv[1], NULL, 10);
- if (n == 0)
+ if (n <= 0)
usage(argv[0]);
}
-
start();
- for (i = 0; i < n * 1000000; i++)
+ for (i = 0; i < 1000000/n; i++)
getuid();
- nsecs = stop() / (n * 1000);
+ nsecs = stop() * n / 1000;
/* returns nanosecs per call */
printf("%lld\n", nsecs);