summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorStan Cox <scox@redhat.com>2008-09-05 19:00:17 -0400
committerStan Cox <scox@redhat.com>2008-09-05 19:00:17 -0400
commite071e49b06c2fe9e20c15ec3719cbaa60ae4afe1 (patch)
treec19de49d6c89c19d5d66fb913c0c7e256cbf460f /elaborate.cxx
parent40be866ffcfc21a15836643cc7c2437ed5c91e8f (diff)
downloadsystemtap-steved-e071e49b06c2fe9e20c15ec3719cbaa60ae4afe1.tar.gz
systemtap-steved-e071e49b06c2fe9e20c15ec3719cbaa60ae4afe1.tar.xz
systemtap-steved-e071e49b06c2fe9e20c15ec3719cbaa60ae4afe1.zip
Handle scalar statistics.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx33
1 files changed, 25 insertions, 8 deletions
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);