summaryrefslogtreecommitdiffstats
path: root/testsuite/buildok/iterate_histogram_buckets.stp
diff options
context:
space:
mode:
authorgraydon <graydon>2005-12-08 02:33:55 +0000
committergraydon <graydon>2005-12-08 02:33:55 +0000
commit71572ba8dfa3b045dfdcd0c8e0a2db168659ea10 (patch)
tree099a29d98018d4ca2e56a1e3cdf476680871eca0 /testsuite/buildok/iterate_histogram_buckets.stp
parent90b474e36fdcb17b1d57f8bb0c01d87b0f5e0a96 (diff)
downloadsystemtap-steved-71572ba8dfa3b045dfdcd0c8e0a2db168659ea10.tar.gz
systemtap-steved-71572ba8dfa3b045dfdcd0c8e0a2db168659ea10.tar.xz
systemtap-steved-71572ba8dfa3b045dfdcd0c8e0a2db168659ea10.zip
2005-12-07 Graydon Hoare <graydon@redhat.com>
* staptree.cxx (traversing_visitor::visit_foreach_loop): Visit the base indexable of the foreach loop. * translate.cxx (c_tmpcounter::visit_foreach_loop): Implement histogram bucket iteration arm. (c_unparser::visit_foreach_loop): Likewise. (c_tmpcounter::visit_arrayindex): Fix typo. * testsuite/buildok/iterate_histogram_buckets.stp: New test.
Diffstat (limited to 'testsuite/buildok/iterate_histogram_buckets.stp')
-rwxr-xr-xtestsuite/buildok/iterate_histogram_buckets.stp30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/buildok/iterate_histogram_buckets.stp b/testsuite/buildok/iterate_histogram_buckets.stp
new file mode 100755
index 00000000..e7b4e48e
--- /dev/null
+++ b/testsuite/buildok/iterate_histogram_buckets.stp
@@ -0,0 +1,30 @@
+#! stap -p4
+
+global foo
+global i
+
+probe begin
+{
+ print("starting up\n")
+ i = 0
+}
+
+probe timer.jiffies(100)
+{
+ printf("ping %d\n", i)
+ foo <<< i
+ if (i++ > 15)
+ exit()
+}
+
+probe end
+{
+ print("shutting down\n")
+ printf("count %d, avg %d\n", @count(foo), @avg(foo))
+ foreach (bucket in @hist_log(foo))
+ {
+ if (@hist_log(foo)[bucket] > 0)
+ printf("bucket %d: %d\n", bucket, @hist_log(foo)[bucket])
+ }
+}
+