diff options
author | hunt <hunt> | 2005-03-09 21:30:05 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-03-09 21:30:05 +0000 |
commit | 204b456c7c08bc40ffe1f21575461d92a544e92b (patch) | |
tree | d4eeb73b11437d723be1e91e0a431f2bd3bed025 /runtime/docs/examples | |
parent | 67b4cc78da121e708a21e96786cb373201e4f6ff (diff) | |
download | systemtap-steved-204b456c7c08bc40ffe1f21575461d92a544e92b.tar.gz systemtap-steved-204b456c7c08bc40ffe1f21575461d92a544e92b.tar.xz systemtap-steved-204b456c7c08bc40ffe1f21575461d92a544e92b.zip |
Initial runtime checkin.
Diffstat (limited to 'runtime/docs/examples')
-rw-r--r-- | runtime/docs/examples/argv.c | 12 | ||||
-rw-r--r-- | runtime/docs/examples/foreach.c | 9 | ||||
-rw-r--r-- | runtime/docs/examples/map.c | 7 |
3 files changed, 28 insertions, 0 deletions
diff --git a/runtime/docs/examples/argv.c b/runtime/docs/examples/argv.c new file mode 100644 index 00000000..5200c350 --- /dev/null +++ b/runtime/docs/examples/argv.c @@ -0,0 +1,12 @@ +MAP arglist ; + +int inst_do_execve (char * filename, char __user *__user *argv, char __user *__user *envp, struct pt_regs * regs) +{ + struct map_node_str *ptr; + + _stp_copy_argv_from_user (arglist, argv); + + foreach (arglist, ptr) + printk ("%s ", ptr->str); + printk ("\n"); +} diff --git a/runtime/docs/examples/foreach.c b/runtime/docs/examples/foreach.c new file mode 100644 index 00000000..fc110674 --- /dev/null +++ b/runtime/docs/examples/foreach.c @@ -0,0 +1,9 @@ +/* example showing how to print all the stats in a map using foreach() */ + +struct map_node_stat *ptr; + +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/map.c b/runtime/docs/examples/map.c new file mode 100644 index 00000000..ca661d05 --- /dev/null +++ b/runtime/docs/examples/map.c @@ -0,0 +1,7 @@ + +/* create a map with a max of 100 elements */ +MAP mymap = map_new(100, INT64); + +/* mymap[birth year] = 2000 */ +map_key_str (mymap, "birth year"); +map_set_int64 (mymap, 2000); |