diff options
author | hunt <hunt> | 2005-11-10 21:19:29 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-11-10 21:19:29 +0000 |
commit | c4f0340669f6c859bfd66e277f235bac457d65d1 (patch) | |
tree | 62a54b010c8a41d24a0591236aaf219fed7c4f25 | |
parent | 02654aefdaf6d3aaa3ab3f5100cf5e1ce32c1d20 (diff) | |
download | systemtap-steved-c4f0340669f6c859bfd66e277f235bac457d65d1.tar.gz systemtap-steved-c4f0340669f6c859bfd66e277f235bac457d65d1.tar.xz systemtap-steved-c4f0340669f6c859bfd66e277f235bac457d65d1.zip |
2005-11-10 Martin Hunt <hunt@redhat.com>
* pmaps/ii2.c: New test of maps and pmaps with the same keysym.
* pmaps/pmap.test: Update.
-rw-r--r-- | runtime/tests/ChangeLog | 5 | ||||
-rw-r--r-- | runtime/tests/pmaps/ii2.c | 48 | ||||
-rw-r--r-- | runtime/tests/pmaps/map_format.c | 2 | ||||
-rw-r--r-- | runtime/tests/pmaps/pmap.test | 17 |
4 files changed, 71 insertions, 1 deletions
diff --git a/runtime/tests/ChangeLog b/runtime/tests/ChangeLog index 6d0381ef..915a55c7 100644 --- a/runtime/tests/ChangeLog +++ b/runtime/tests/ChangeLog @@ -1,3 +1,8 @@ +2005-11-10 Martin Hunt <hunt@redhat.com> + + * pmaps/ii2.c: New test of maps and pmaps with the same keysym. + * pmaps/pmap.test: Update. + 2005-11-09 Martin Hunt <hunt@redhat.com> * maps/sort2.c: New file. diff --git a/runtime/tests/pmaps/ii2.c b/runtime/tests/pmaps/ii2.c new file mode 100644 index 00000000..ecded8c1 --- /dev/null +++ b/runtime/tests/pmaps/ii2.c @@ -0,0 +1,48 @@ +#include "runtime.h" + +/* test of maps and pmaps with keys of int64 and value of int64 */ + +/* Make sure we can cleanly generate both */ + +#define VALUE_TYPE INT64 +#define KEY1_TYPE INT64 +#include "pmap-gen.c" + +#define VALUE_TYPE INT64 +#define KEY1_TYPE INT64 +#include "map-gen.c" + +#include "map.c" + +int main () +{ + MAP map = _stp_map_new_ii(4); + MAP pmap = _stp_pmap_new_ii(4); + int64_t x; + + /* put some data in. _processor_number is a global hack that allows */ + /* us to set the current emulated cpu number for our userspace tests. */ + /* Note that we set values based on the cpu number just to show that */ + /* different values are stored in each cpu */ + for (_processor_number = 0; _processor_number < NR_CPUS; _processor_number++) { + _stp_pmap_add_ii(pmap, 1, _processor_number); + _stp_pmap_add_ii(pmap, 2, 10 *_processor_number + 1); + _stp_pmap_add_ii(pmap, 3, _processor_number * _processor_number); + _stp_pmap_add_ii(pmap, 4, 1); + _stp_map_add_ii(map, 1, _processor_number); + _stp_map_add_ii(map, 2, 10 *_processor_number + 1); + _stp_map_add_ii(map, 3, _processor_number * _processor_number); + _stp_map_add_ii(map, 4, 1); + } + + _processor_number = 0; + + /* print the aggregated data */ + _stp_map_print(map,"map[%1d] = %d"); + _stp_pmap_print(pmap,"pmap[%1d] = %d"); + + _stp_map_del (map); + _stp_pmap_del (pmap); + return 0; +} + diff --git a/runtime/tests/pmaps/map_format.c b/runtime/tests/pmaps/map_format.c index 5b99b64e..e6c6d9f6 100644 --- a/runtime/tests/pmaps/map_format.c +++ b/runtime/tests/pmaps/map_format.c @@ -81,7 +81,7 @@ int main () /* here's how to print a map without using _stp_pmap_print(). */ _stp_pmap_agg (mapssx); struct map_node *ptr; - foreach (AGG_PMAP(mapssx), ptr) + foreach (_stp_pmap_get_agg(mapssx), ptr) _stp_printf ("mapssx[%09s,%09s] = %llX\n", key1str(ptr), key2str(ptr), _stp_get_stat(ptr)->sum); _stp_print_flush(); diff --git a/runtime/tests/pmaps/pmap.test b/runtime/tests/pmaps/pmap.test index a8f82506..4e6a6ce4 100644 --- a/runtime/tests/pmaps/pmap.test +++ b/runtime/tests/pmaps/pmap.test @@ -370,6 +370,23 @@ mapssx[ Riga, Latvia] = 322D82 mapssx[ Sofia, Bulgaria] = 7E9 mapssx[ Valletta, Malta] = B22} + +test ii2 {Test of maps and pmaps with int64 keys and int64 values} -setup { + exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ii2.c +} -body { + exec ./test +} -result {map[2] = 288 +map[4] = 8 +map[1] = 28 +map[3] = 140 + +pmap[2] = 288 +pmap[4] = 8 +pmap[1] = 28 +pmap[3] = 140 +} + + catch {exec rm test} cleanupTests |