summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStan Cox <scox@redhat.com>2008-09-01 17:25:06 -0400
committerStan Cox <scox@redhat.com>2008-09-01 17:25:06 -0400
commite491a713fa72f536955be51c0222a3f0b1befc82 (patch)
treec4f0138c6e244c00def073f567e9fda13959d996
parent5e314609f46deb737967305f59356243cb65c310 (diff)
downloadsystemtap-steved-e491a713fa72f536955be51c0222a3f0b1befc82.tar.gz
systemtap-steved-e491a713fa72f536955be51c0222a3f0b1befc82.tar.xz
systemtap-steved-e491a713fa72f536955be51c0222a3f0b1befc82.zip
Display written but unread global statistics.
-rw-r--r--ChangeLog4
-rw-r--r--elaborate.cxx35
-rw-r--r--testsuite/ChangeLog5
-rw-r--r--testsuite/systemtap.base/global_end.exp4
-rw-r--r--testsuite/systemtap.base/global_end.stp11
5 files changed, 53 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 2db4cf2f..3a8c8e6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-01 Stan Cox <scox@redhat.com>
+
+ * elaborate.cxx (add_global_var_display): Also handle statistics.
+
2008-08-29 Dave Brolley <brolley@redhat.com>
* stap-server.8.in: New man page.
diff --git a/elaborate.cxx b/elaborate.cxx
index 7ecba049..cfbe1392 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1160,8 +1160,7 @@ void add_global_var_display (systemtap_session& s)
{
vardecl* l = s.globals[g];
if (vut.read.find (l) != vut.read.end()
- || vut.written.find (l) == vut.written.end()
- || l->type == pe_stats)
+ || vut.written.find (l) == vut.written.end())
continue;
print_format* pf = new print_format;
@@ -1255,7 +1254,9 @@ void add_global_var_display (systemtap_session& s)
pf->raw_components += "%#d";
}
pf->raw_components += "]";
- 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";
@@ -1264,12 +1265,38 @@ void add_global_var_display (systemtap_session& s)
struct arrayindex* ai = new arrayindex;
ai->tok = l->tok;
ai->base = g_sym;
+
for (int i=0; i < idx_count; i++)
{
ai->indexes.push_back (idx_sym[i]);
pf->args.push_back(idx_sym[i]);
}
- pf->args.push_back(ai);
+ if (l->type == pe_stats)
+ {
+ struct stat_op* so [5];
+ token* so_tok [5];
+
+ for (unsigned sti = 0; sti < (sizeof(so_tok)/sizeof(token*)); sti++)
+ {
+ so_tok[sti] = new token;
+ so_tok[sti]->type = tok_identifier;
+ }
+ const stat_component_type stypes[] = {sc_count, sc_min, sc_max, sc_sum, sc_average};
+ for (unsigned si = 0; si < (sizeof(so_tok)/sizeof(token*)); si++)
+ {
+ so[si]= new stat_op;
+ so[si]->ctype = stypes[si];
+ so[si]->type = pe_long;
+ so[si]->stat = ai;
+ so[si]->tok = so_tok[si];
+ }
+
+ ai->type = pe_stats;
+ for (unsigned si = 0; si < (sizeof(so_tok)/sizeof(token*)); si++)
+ pf->args.push_back(so[si]);
+ }
+ else
+ pf->args.push_back(ai);
pf->components = print_format::string_to_components(pf->raw_components);
expr_statement* feb = new expr_statement;
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index a0e19521..26573fcb 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-01 Stan Cox <scox@redhat.com>
+
+ * systemtap.base/global_end.stp: Also check statistics.
+ * systemtap.base/global_end.exp: Likewise.
+
2008-08-29 David Smith <dsmith@redhat.com>
PR6841
diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp
index 08cf0dea..d066cf9d 100644
--- a/testsuite/systemtap.base/global_end.exp
+++ b/testsuite/systemtap.base/global_end.exp
@@ -16,8 +16,10 @@ expect {
-re {gamma="abcdefghijklmnopqrstuvwxyz"} { incr ok; exp_continue }
-re {iota."one".="eleven"} { incr ok; exp_continue }
-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 }
timeout { fail "$test (timeout)" }
eof { }
}
wait
-if {$ok == 8} { pass "$test ($ok)" } { fail "$test ($ok)" }
+if {$ok == 10} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.base/global_end.stp b/testsuite/systemtap.base/global_end.stp
index e9a1eb8f..b26b7c03 100644
--- a/testsuite/systemtap.base/global_end.stp
+++ b/testsuite/systemtap.base/global_end.stp
@@ -1,4 +1,4 @@
-global alpha, beta, gamma, iota
+global alpha, beta, gamma, iota, epsilon
probe begin {
gamma = "abcdefghijklmnopqrstuvwxyz"
@@ -15,6 +15,15 @@ probe begin {
beta["one",2] = 2
beta["two",1] = 3
beta["two",2] = 4
+
+ epsilon["one",1] <<< 1
+ epsilon["one",1] <<< 2
+ epsilon["one",1] <<< 3
+ epsilon["one",1] <<< 4
+ epsilon["two",2] <<< 10
+ epsilon["two",2] <<< 20
+ epsilon["two",2] <<< 30
+ epsilon["two",2] <<< 40
}
probe timer.ms(2000) {