diff options
author | hunt <hunt> | 2005-10-26 08:08:53 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-10-26 08:08:53 +0000 |
commit | d06fc47a2be5a31f770595211a719fe0e6c0cc13 (patch) | |
tree | 980f15972175169238b8f4942b261d9e72943a60 /runtime/tests/maps/isx.c | |
parent | 1dcb36dc4ad16c1b842d0961cd6a5d8e57c97b87 (diff) | |
download | systemtap-steved-d06fc47a2be5a31f770595211a719fe0e6c0cc13.tar.gz systemtap-steved-d06fc47a2be5a31f770595211a719fe0e6c0cc13.tar.xz systemtap-steved-d06fc47a2be5a31f770595211a719fe0e6c0cc13.zip |
2005-10-26 Martin Hunt <hunt@redhat.com>
* maps/map.test: Update with results for new tests.
* maps/*2.c: Tests for the new API.
* maps/ist.c: Renamed isx.c.
* maps/setadd.c: New test of adding and setting.
Diffstat (limited to 'runtime/tests/maps/isx.c')
-rw-r--r-- | runtime/tests/maps/isx.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/runtime/tests/maps/isx.c b/runtime/tests/maps/isx.c new file mode 100644 index 00000000..2418a20c --- /dev/null +++ b/runtime/tests/maps/isx.c @@ -0,0 +1,46 @@ +#include "runtime.h" + +/* test of maps with keys of int64 and value of stat */ +#define NEED_STAT_VALS +#define KEY1_TYPE INT64 +#include "map-keys.c" +#include "map.c" + +int main () +{ + int i, j; + MAP map = _stp_map_new_int64(4, HSTAT_LINEAR, 0, 100, 10 ); + MAP map2 = _stp_map_new_int64(4, HSTAT_LOG, 11); + + _stp_map_key_int64 (map, 3); + for (i = 0; i < 100; i++) + for (j = 0; j <= i*10 ; j++ ) + _stp_map_add_int64 (map, i); + + _stp_map_key_int64 (map, 2); + for (i = 0; i < 10; i++) + for (j = 0; j < 10 ; j++ ) + _stp_map_add_int64 (map, j * i ); + + _stp_map_key_int64 (map, 1); + for (i = 0; i < 100; i += 10) + for (j = 0; j < i/10 ; j++ ) + _stp_map_add_int64 (map, i); + + _stp_map_key_int64 (map2, 1); + for (i = 0; i < 128; i++) + for (j = 0; j < 128 ; j++ ) + _stp_map_add_int64 (map2, i); + + _stp_map_key_int64 (map2, 2); + for (i = 0; i < 1024; i++) + for (j = 0; j < 1024 ; j++ ) + _stp_map_add_int64 (map2, i); + + _stp_map_print (map, "map[%1d] = count:%C sum:%S avg:%A min:%m max:%M\n%H"); + _stp_map_print (map2, "map2[%1d] = count:%C sum:%S avg:%A min:%m max:%M\n%H"); + + _stp_map_del (map); + _stp_map_del (map2); + return 0; +} |