summaryrefslogtreecommitdiffstats
path: root/runtime/tests/maps/ist.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-05-17 06:58:05 +0000
committerhunt <hunt>2005-05-17 06:58:05 +0000
commitca7d122b7b3fb57d6cabdbdc5da9c1ecc60de5d8 (patch)
tree7272af5f7bfb67412fbdbfa2a9cc7f63e8fa09c3 /runtime/tests/maps/ist.c
parente96dd1fa4e4ba81198e92f7abd340124ba126258 (diff)
downloadsystemtap-steved-ca7d122b7b3fb57d6cabdbdc5da9c1ecc60de5d8.tar.gz
systemtap-steved-ca7d122b7b3fb57d6cabdbdc5da9c1ecc60de5d8.tar.xz
systemtap-steved-ca7d122b7b3fb57d6cabdbdc5da9c1ecc60de5d8.zip
Restructuring of tests. New tests for new maps.
Diffstat (limited to 'runtime/tests/maps/ist.c')
-rw-r--r--runtime/tests/maps/ist.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/runtime/tests/maps/ist.c b/runtime/tests/maps/ist.c
new file mode 100644
index 00000000..24eb6f42
--- /dev/null
+++ b/runtime/tests/maps/ist.c
@@ -0,0 +1,50 @@
+#include "runtime.h"
+
+/* test of maps with keys of int64 and value of stat */
+
+#define KEY1_TYPE INT64
+#include "map-keys.c"
+
+#define VALUE_TYPE STAT
+#include "map-values.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_stat (map, i);
+
+ _stp_map_key_int64 (map, 2);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10 ; j++ )
+ _stp_map_add_int64_stat (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_stat (map, i);
+
+ _stp_map_key_int64 (map2, 1);
+ for (i = 0; i < 128; i++)
+ for (j = 0; j < 128 ; j++ )
+ _stp_map_add_int64_stat (map2, i);
+
+ _stp_map_key_int64 (map2, 2);
+ for (i = 0; i < 1024; i++)
+ for (j = 0; j < 1024 ; j++ )
+ _stp_map_add_int64_stat (map2, i);
+
+ _stp_map_print (map, "map");
+ _stp_map_print (map2, "map2");
+
+ _stp_map_del (map);
+ _stp_map_del (map2);
+ return 0;
+}