diff options
author | Ali Saidi <Ali.Saidi@ARM.com> | 2012-06-05 01:23:10 -0400 |
---|---|---|
committer | Ali Saidi <Ali.Saidi@ARM.com> | 2012-06-05 01:23:10 -0400 |
commit | 2e988bbab0c1a3c90c69b03fc79a62d7c61a540a (patch) | |
tree | 3bc173551afe24c8ac14c295b480e245b4c29fb2 | |
parent | 6df196b71e058b2c827e1027416155ac8ec8cf9f (diff) | |
download | gem5-2e988bbab0c1a3c90c69b03fc79a62d7c61a540a.tar.xz |
stats: Add stats unittest for total calculations.
-rw-r--r-- | src/unittest/stattest.cc | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/unittest/stattest.cc b/src/unittest/stattest.cc index ccce2173b..67eb5c323 100644 --- a/src/unittest/stattest.cc +++ b/src/unittest/stattest.cc @@ -94,27 +94,37 @@ struct StatTest Histogram h12; SparseHistogram sh1; + Vector s19; + Vector s20; + Formula f1; Formula f2; Formula f3; Formula f4; Formula f5; + Formula f6; void run(); void init(); }; -StatTest __stattest; +StatTest & +__stattest() +{ + static StatTest st; + return st; +} + void stattest_init() { - __stattest.init(); + __stattest().init(); } void stattest_run() { - __stattest.run(); + __stattest().run(); } void @@ -352,6 +362,24 @@ StatTest::init() .desc("this is formula 4") ; + s19 + .init(2) + .name("Stat19") + .desc("this is statistic 19 for vector op testing") + .flags(total | nozero | nonan) + ; + s20 + .init(2) + .name("Stat20") + .desc("this is statistic 20 for vector op testing") + .flags(total | nozero | nonan) + ; + + f6 + .name("vector_op_test_formula") + .desc("The total stat should equal 1") + .flags(total |nozero |nonan) + ; f1 = s1 + s2; f2 = (-s1) / (-s2) * (-s3 + ULL(100) + s4); @@ -359,6 +387,7 @@ StatTest::init() f4 += constant(10.0); f4 += s5[3]; f5 = constant(1); + f6 = s19/s20; } void @@ -634,4 +663,10 @@ StatTest::run() for (int i = 0; i < 1000; i++) { sh1.sample(random() % 10000); } + + s19[0] = 1; + s19[1] = 100000; + s20[0] = 100000; + s20[1] = 1; + } |