diff options
author | graydon <graydon> | 2005-11-24 05:55:52 +0000 |
---|---|---|
committer | graydon <graydon> | 2005-11-24 05:55:52 +0000 |
commit | 07c17d677a8080492b4a67b664f4cc9557f5dda3 (patch) | |
tree | ddff61760db8a9d3067f3e559ce36eca9e642811 /testsuite/buildok | |
parent | 5bb3c2a0266268e63d373de4df3fed2bb7d3be67 (diff) | |
download | systemtap-steved-07c17d677a8080492b4a67b664f4cc9557f5dda3.tar.gz systemtap-steved-07c17d677a8080492b4a67b664f4cc9557f5dda3.tar.xz systemtap-steved-07c17d677a8080492b4a67b664f4cc9557f5dda3.zip |
2005-11-23 Graydon Hoare <graydon@redhat.com>
* elaborate.h (get_symbol_within_expression): Make visible.
* elaborate.cxx (get_symbol_within_expression): Make non-static.
(stat_decl_collector): New struct.
(semantic_pass_stats): New semantic pass.
(semantic_pass): Call it.
(semantic_pass_symbols): Remove collection of statistic_decls from files.
(visit_stat_op): Only fail if inferred type is not pe_long.
* parse.cxx (parser::parse): Don't pass per-file statistic_decl
into parse_global.
(parser::parse_global): Don't parse global statistic_decls,
they're obsolete.
* parse.hh (parser::parse_global): Adjust signature to match.
* session.h (statistic_decl::operator==): New method.
* staptree.h (print_format::is_empty): New method.
(stapfile::stat_decls): Remove field.
* staptree.cxx (string_to_components): Fix bugs in format-string
parser.
* translate.cxx (var): Make private fields protected.
(var::init): Support HIST_NONE stats.
(aggvar): New struct.
(mapvar::is_parallel): New method.
(mapvar::call_prefix): Use it.
(mapvar::calculate_aggregate): New method.
(mapvar::fetch_existing_aggregate): New method.
(mapvar::get): Support pe_stats.
(mapvar::init): Use is_parallel(), and support HIST_NONE.
(itervar::itervar): Only fault on pe_unknown.
(itervar::start): Use mapvar::is_parallel and
mapvar::fetch_existing_aggregate.
(emit_map_type_instantiations): Include alloc.c before pmap-gen.c.
Include pmap-gen.c for pe_stats maps.
(c_unparser::gensym_aggregate): New method.
(c_unparser::visit_foreach_loop): Handle mapvar::is_parallel case.
(arrayindex_downcaster): New struct.
(expression_is_arrayindex): New function.
(c_tmpcounter::visit_stat_op): New method.
(c_unparser::visit_stat_op): Implement.
(c_unparser::visit_hist_op): Add commentary, still not implemented.
* testsuite/buildok/stat_{insert,extract}.stp: New tests.
* testsuite/semok/ten.stp: Correct for changes to global declarations.
* testsuite/semko/*.stp: Likewise.
Diffstat (limited to 'testsuite/buildok')
-rwxr-xr-x | testsuite/buildok/stat_extract.stp | 27 | ||||
-rwxr-xr-x | testsuite/buildok/stat_insert.stp | 62 |
2 files changed, 89 insertions, 0 deletions
diff --git a/testsuite/buildok/stat_extract.stp b/testsuite/buildok/stat_extract.stp new file mode 100755 index 00000000..82b37545 --- /dev/null +++ b/testsuite/buildok/stat_extract.stp @@ -0,0 +1,27 @@ +#! stap -p4 + +# test the translatability of the statistic extraction operators + +global foo +global bar + +global i + +probe timer.ms(100) +{ + foo <<< i++ + bar[10,"hello"] <<< (12 * i) + if (@count(foo) > 1000) + exit() +} + +probe begin +{ + i = 1 +} + +probe end +{ + printf("foo: min %d, max %d, count %d, sum %d, avg %d\n", + @min(foo), @max(foo), @count(foo), @sum(foo), @avg(foo)) +} diff --git a/testsuite/buildok/stat_insert.stp b/testsuite/buildok/stat_insert.stp new file mode 100755 index 00000000..4039a190 --- /dev/null +++ b/testsuite/buildok/stat_insert.stp @@ -0,0 +1,62 @@ +#! stap -p4 + +# test the translatability of the statistic insertion operator + +global loggy +global logmap +global liney +global linemap + +global numbers +global strings + +function wibble() +{ + i = 0 + logmap[i++, "stewed"] <<< 1 + logmap[i++, "boiled"] <<< 1 + 2 + logmap[i++, "baked"] <<< x + logmap[i++, "fried"] <<< (x * y) + 3 +} + +function wobble() +{ + foreach (i in numbers) + { + foreach (j in strings) + { + linemap[strings[j],2*numbers[i],numbers[2*i]] <<< x * (y + i) + } + } +} + + +probe end { + + numbers[1] = 2 + numbers[2] = 5 + numbers[3] = 98279 + numbers[4] = 8739287 + + strings[1] = "sun" + strings[2] = "moon" + strings[3] = "saturn" + strings[4] = "venus" + + p = 4 + q = 5 + + liney <<< 1 + liney <<< 1 + 2 + liney <<< p + liney <<< (p * q) + 3 + + loggy <<< 1 + loggy <<< 1 + 2 + loggy <<< p + loggy <<< (p * q) + 3 + + wibble() + wobble() + +} |