diff options
author | Stan Cox <scox@redhat.com> | 2008-09-05 19:00:17 -0400 |
---|---|---|
committer | Stan Cox <scox@redhat.com> | 2008-09-05 19:00:17 -0400 |
commit | e071e49b06c2fe9e20c15ec3719cbaa60ae4afe1 (patch) | |
tree | c19de49d6c89c19d5d66fb913c0c7e256cbf460f | |
parent | 40be866ffcfc21a15836643cc7c2437ed5c91e8f (diff) | |
download | systemtap-steved-e071e49b06c2fe9e20c15ec3719cbaa60ae4afe1.tar.gz systemtap-steved-e071e49b06c2fe9e20c15ec3719cbaa60ae4afe1.tar.xz systemtap-steved-e071e49b06c2fe9e20c15ec3719cbaa60ae4afe1.zip |
Handle scalar statistics.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | elaborate.cxx | 33 | ||||
-rw-r--r-- | testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | testsuite/systemtap.base/global_end.exp | 3 | ||||
-rw-r--r-- | testsuite/systemtap.base/global_end.stp | 7 |
5 files changed, 42 insertions, 10 deletions
@@ -1,3 +1,7 @@ +2008-09-05 Stan Cox <scox@redhat.com> + + * elaborate.cxx (add_global_var_display): Handle scalar statistics. + 2008-09-05 Frank Ch. Eigler <fche@elastic.org> * configure.ac, Makefile.am, systemtap.spec: Don't look for libcap. diff --git a/elaborate.cxx b/elaborate.cxx index 44b6e24f..3dfc7183 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1194,15 +1194,35 @@ void add_global_var_display (systemtap_session& s) if (l->index_types.size() == 0) // Scalar { - if (l->type == pe_string) + if (l->type == pe_stats) + pf->raw_components += " @count=%#x @min=%#x @max=%#x @sum=%#x @avg=%#x\\n"; + else if (l->type == pe_string) pf->raw_components += "=\"%#s\"\\n"; else pf->raw_components += "=%#x\\n"; - pf->args.push_back(g_sym); pf->components = print_format::string_to_components(pf->raw_components); expr_statement* feb = new expr_statement; feb->value = pf; feb->tok = print_tok; + if (l->type == pe_stats) + { + struct stat_op* so [5]; + const stat_component_type stypes[] = {sc_count, sc_min, sc_max, sc_sum, sc_average}; + + for (unsigned si = 0; + si < (sizeof(so)/sizeof(struct stat_op*)); + si++) + { + so[si]= new stat_op; + so[si]->ctype = stypes[si]; + so[si]->type = pe_long; + so[si]->stat = g_sym; + so[si]->tok = l->tok; + pf->args.push_back(so[si]); + } + } + else + pf->args.push_back(g_sym); b->statements.push_back(feb); } else // Array @@ -1265,6 +1285,8 @@ void add_global_var_display (systemtap_session& s) { struct stat_op* so [5]; const stat_component_type stypes[] = {sc_count, sc_min, sc_max, sc_sum, sc_average}; + + ai->type = pe_stats; for (unsigned si = 0; si < (sizeof(so)/sizeof(struct stat_op*)); si++) @@ -1274,13 +1296,8 @@ void add_global_var_display (systemtap_session& s) so[si]->type = pe_long; so[si]->stat = ai; so[si]->tok = l->tok; + pf->args.push_back(so[si]); } - - ai->type = pe_stats; - for (unsigned si = 0; - si < (sizeof(so)/sizeof(struct stat_op*)); - si++) - pf->args.push_back(so[si]); } else pf->args.push_back(ai); diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index ff907094..82435044 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-05 Stan Cox <scox@redhat.com> + + * systemtap.base/global_end.stp: Also check scalar statistics. + * systemtap.base/global_end.exp: Likeewise. + 2008-09-05 Frank Ch. Eigler <fche@elastic.org> PR 4255. diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp index d066cf9d..cd5c6f83 100644 --- a/testsuite/systemtap.base/global_end.exp +++ b/testsuite/systemtap.base/global_end.exp @@ -18,8 +18,9 @@ expect { -re {iota."two".="twelve"} { incr ok; exp_continue } -re {epsilon."one",1. @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue } -re {epsilon."two",2. @count=0x4 @min=0xa @max=0x28 @sum=0x64 @avg=0x19} { incr ok; exp_continue } + -re {phi @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue } timeout { fail "$test (timeout)" } eof { } } wait -if {$ok == 10} { pass "$test ($ok)" } { fail "$test ($ok)" } +if {$ok == 11} { pass "$test ($ok)" } { fail "$test ($ok)" } diff --git a/testsuite/systemtap.base/global_end.stp b/testsuite/systemtap.base/global_end.stp index b26b7c03..876eac8c 100644 --- a/testsuite/systemtap.base/global_end.stp +++ b/testsuite/systemtap.base/global_end.stp @@ -1,4 +1,4 @@ -global alpha, beta, gamma, iota, epsilon +global alpha, beta, gamma, iota, epsilon, phi probe begin { gamma = "abcdefghijklmnopqrstuvwxyz" @@ -16,6 +16,11 @@ probe begin { beta["two",1] = 3 beta["two",2] = 4 + phi <<< 1 + phi <<< 2 + phi <<< 3 + phi <<< 4 + epsilon["one",1] <<< 1 epsilon["one",1] <<< 2 epsilon["one",1] <<< 3 |