From 9e6283482f254af6cac6fadadf2e78baac9e031d Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 17 Mar 2016 21:24:50 -0400 Subject: [PATCH] PR19802: hashbench.stp Rework into the beginning of a hash benchmark suite. The first test is for plotting 1/2/3-d hash value distributions, with a bunch of modifiable parameters (use stap "-G param=value"). --- testsuite/systemtap.base/hashbench.stp | 113 ++++++++++++++++--------- 1 file changed, 71 insertions(+), 42 deletions(-) mode change 100644 => 100755 testsuite/systemtap.base/hashbench.stp diff --git a/testsuite/systemtap.base/hashbench.stp b/testsuite/systemtap.base/hashbench.stp old mode 100644 new mode 100755 index 66acca108..5820c9bfc --- a/testsuite/systemtap.base/hashbench.stp +++ b/testsuite/systemtap.base/hashbench.stp @@ -1,44 +1,72 @@ -global iLimit = 2000; -global jLimit = 70; -global buckets[140000]; /* iLimit * jLimit */ +#! /bin/sh + +//bin/true && exec stap -t -g --suppress-time-limits $0 "$@" + +// add extra -G parameters to override these test parameters +global dims = 3; +global iLimit = 100; +global jLimit = 100; +global kLimit = 100; +global hashmask = 0xFFFFF; +global randomize = 0; +global buckets[1000000]; /* <= iLimit * jLimit * kLimit */ global bucketCounts; -global stats[500000]; -function gimmeHash:long(a:long, b:long) %{ + +function gimmeHash1:long(a:long) %{ + STAP_RETVALUE = hash_ix(STAP_ARG_a); +%} +function gimmeHash2:long(a:long, b:long) %{ STAP_RETVALUE = hash_iix(STAP_ARG_a, STAP_ARG_b); %} -function gimmeHash64:long(a:long) %{ - STAP_RETVALUE = hash_64(STAP_ARG_a, 32); +function gimmeHash3:long(a:long, b:long, c:long) %{ + STAP_RETVALUE = hash_iiix(STAP_ARG_a, STAP_ARG_b, STAP_ARG_c); %} +global stats1[1], stats2[1], stats3[1]; +probe never +{ + stats1[0] <<< 1; + stats2[0,1] <<< 1; + stats3[0,1,2] <<< 1; + println(@count(stats1[0]) + @count(stats2[0,1]) + @count(stats3[0,1,2])) +} + -probe begin +function rnd(x) { - stats[0,1] <<< 42; /* force the _iix routines to be available */ - printf("max map entries: %d\n", %{ MAXMAPENTRIES %}); - printf("hash table bits: %d size: %d\n", - %{ HASH_TABLE_BITS %}, %{ HASH_TABLE_SIZE %}); - printf("seed: %x", %{ stap_hash_seed %}); - printf(" ignore these: %d %d\n", @count(stats[0,1]), @count(stats[1,0])); - if (%{MAXMAPENTRIES%} < iLimit*jLimit) { - printf("MAXMAPENTRIES too small, should be at least %d\n", - iLimit * jLimit); - exit(); - next; - } - for (i = 0; i < iLimit; i++) { - if (i < 4) { printf("hash(%d,*):", i); } - for (j = 0; j < jLimit; j++) { - hash = gimmeHash(i, j); - if (i < 4) { - if ((j % 16) == 0) { printf("\n %2d:", j); } - printf(" %06x", hash); - } - buckets[hash]++; - } - if (i < 4) { printf("\n"); } - } - printf("etc...\n"); - /* Now buckets[] maps hash value to number of times it came up. */ + return (randomize ? randint(1000000) : x) +} + + +probe begin(0) +{ + printf("parameters:\n\tdims=%d hashmask=%x\n", dims, hashmask) + printf("\tiLimit=%d jLimit=%d kLimit=%d randomize=%d\n", iLimit, jLimit, kLimit, randomize) + printf("seed=%x\n", %{ stap_hash_seed %}); +} + +probe begin(1) +{ + if (dims == 1) { + for (i=0; i