From e5d2abb56ca57a613e4ef9398a6499190b2265be Mon Sep 17 00:00:00 2001 From: hunt Date: Sat, 18 Jun 2005 07:24:42 +0000 Subject: 2005-06-18 Martin Hunt * counter.c: New file. Counter aggregations. * stat.c: New file. Stat aggregations. * stat.h: Header file for stats. * map-int.c: New file. Support for int64 values. * map-stat.c: New file. Support for stat values. * map-str.c: New file. Support for string values. * map-values.c: Now just includes the necessary map-*.c files. * stat-common.c: New file. Stats stuff common to Stats and maps containing stats. * Doxyfile: Bumped version to 0.6. * README: Renamed README.doc and reorganized. --- runtime/docs/examples/argv.c | 5 +++-- runtime/docs/examples/foreach.c | 10 +++++----- runtime/docs/examples/list.c | 7 +++++-- runtime/docs/examples/map.c | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) (limited to 'runtime/docs/examples') diff --git a/runtime/docs/examples/argv.c b/runtime/docs/examples/argv.c index 609ad74f..0acd41e0 100644 --- a/runtime/docs/examples/argv.c +++ b/runtime/docs/examples/argv.c @@ -8,6 +8,7 @@ int inst_do_execve (char * filename, char __user *__user *argv, char __user *__u _stp_copy_argv_from_user (arglist, argv); foreach (arglist, ptr) - printk ("%s ", ptr->str); - printk ("\n"); + _stp_printf ("%s ", _stp_get_str(ptr)); + _stp_print("\n"); + } diff --git a/runtime/docs/examples/foreach.c b/runtime/docs/examples/foreach.c index fc110674..8000d60b 100644 --- a/runtime/docs/examples/foreach.c +++ b/runtime/docs/examples/foreach.c @@ -1,9 +1,9 @@ /* example showing how to print all the stats in a map using foreach() */ -struct map_node_stat *ptr; + struct map_node *ptr; + + foreach (mapsst, ptr) + _stp_printf ("mapsst[%09s,%09s] = %llX\n", key1str(ptr), key2str(ptr), _stp_get_stat(ptr)->sum); + -foreach (map, ptr) - printf ("map[%s,%ld] = [c=%lld s=%lld min=%lld max=%lld]\n", key1str(ptr), - key2int(ptr), ptr->stats.count, ptr->stats.sum, ptr->stats.min, - ptr->stats.max); diff --git a/runtime/docs/examples/list.c b/runtime/docs/examples/list.c index 15d13d4b..6294cccb 100644 --- a/runtime/docs/examples/list.c +++ b/runtime/docs/examples/list.c @@ -1,5 +1,5 @@ -struct map_node_str *ptr; +struct map_node *ptr; MAP map = _stp_list_new(10, STRING); @@ -8,7 +8,10 @@ for (i = 0; i < 10; i++) { _stp_list_add (map, buf); } +/* old way to print a list of strings */ foreach (map, ptr) - printf ("map[%ld] = %s\n", key1int(ptr), ptr->str); + _stp_printf ("list[%ld] = %s\n", key1int(ptr), _stp_get_str(ptr)); +/* new way to print a list of strings */ + _stp_map_print(map, "list[%1d] = %s"); diff --git a/runtime/docs/examples/map.c b/runtime/docs/examples/map.c index ca661d05..f5f6f19f 100644 --- a/runtime/docs/examples/map.c +++ b/runtime/docs/examples/map.c @@ -1,6 +1,6 @@ /* create a map with a max of 100 elements */ -MAP mymap = map_new(100, INT64); +MAP mymap = _stp_map_new(100, INT64); /* mymap[birth year] = 2000 */ map_key_str (mymap, "birth year"); -- cgit