diff options
author | Nathan Binkert <nate@binkert.org> | 2009-02-23 12:04:52 -0800 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2009-02-23 12:04:52 -0800 |
commit | bcb7e70178d2d15a8c30561311634df7a2c24c70 (patch) | |
tree | f6def52cafbc262701ab350f93fa3a4079db97dc /src | |
parent | d940a2b74180221dd32ad43d07b099a024f6b52e (diff) | |
download | gem5-bcb7e70178d2d15a8c30561311634df7a2c24c70.tar.xz |
stats: clean up the statistics unittest
Diffstat (limited to 'src')
-rw-r--r-- | src/unittest/stattest.cc | 105 |
1 files changed, 55 insertions, 50 deletions
diff --git a/src/unittest/stattest.cc b/src/unittest/stattest.cc index 78d43c6f3..30b7f8a6c 100644 --- a/src/unittest/stattest.cc +++ b/src/unittest/stattest.cc @@ -42,31 +42,6 @@ using namespace std; using namespace Stats; -Scalar<> s1; -Scalar<> s2; -Average<> s3; -Scalar<> s4; -Vector<> s5; -Distribution<> s6; -Vector<> s7; -AverageVector<> s8; -StandardDeviation<> s9; -AverageDeviation<> s10; -Scalar<> s11; -Distribution<> s12; -VectorDistribution<> s13; -VectorStandardDeviation<> s14; -VectorAverageDeviation<> s15; -Vector2d<> s16; - -Formula f1; -Formula f2; -Formula f3; -Value f4; -Value f5; -Formula f6; -Formula f7; - double testfunc() { @@ -141,15 +116,34 @@ main(int argc, char *argv[]) if (!text && (compat || descriptions)) usage(); - s5.init(5); - s6.init(1, 100, 13); - s7.init(7); - s8.init(10); - s12.init(1, 100, 13); - s13.init(4, 0, 99, 10); - s14.init(9); - s15.init(10); - s16.init(2, 9); + Scalar<> s1; + Scalar<> s2; + Average<> s3; + Scalar<> s4; + Vector<> s5; + Distribution<> s6; + Vector<> s7; + AverageVector<> s8; + StandardDeviation<> s9; + AverageDeviation<> s10; + Scalar<> s11; + Distribution<> s12; + VectorDistribution<> s13; + VectorStandardDeviation<> s14; + VectorAverageDeviation<> s15; + Vector2d<> s16; + Value s17; + Value s18; + + Formula f1; + Formula f2; + Formula f3; + Formula f4; + Formula f5; + + cprintf("sizeof(Scalar<>) = %d\n", sizeof(Scalar<>)); + cprintf("sizeof(Vector<>) = %d\n", sizeof(Vector<>)); + cprintf("sizeof(Distribution<>) = %d\n", sizeof(Distribution<>)); s1 .name("Stat01") @@ -165,7 +159,7 @@ main(int argc, char *argv[]) s3 .name("Stat03") .desc("this is statistic 3") - .prereq(f7) + .prereq(f5) ; s4 @@ -175,6 +169,7 @@ main(int argc, char *argv[]) ; s5 + .init(5) .name("Stat05") .desc("this is statistic 5") .prereq(s11) @@ -186,12 +181,14 @@ main(int argc, char *argv[]) ; s6 + .init(1, 100, 13) .name("Stat06") .desc("this is statistic 6") .prereq(s11) ; s7 + .init(7) .name("Stat07") .desc("this is statistic 7") .precision(1) @@ -200,6 +197,7 @@ main(int argc, char *argv[]) ; s8 + .init(10) .name("Stat08") .desc("this is statistic 8") .precision(2) @@ -221,26 +219,31 @@ main(int argc, char *argv[]) ; s12 + .init(1, 100, 13) .name("Stat12") .desc("this is statistic 12") ; s13 + .init(4, 0, 99, 10) .name("Stat13") .desc("this is statistic 13") ; s14 + .init(9) .name("Stat14") .desc("this is statistic 14") ; s15 + .init(10) .name("Stat15") .desc("this is statistic 15") ; s16 + .init(2, 9) .name("Stat16") .desc("this is statistic 16") .flags(total) @@ -250,6 +253,20 @@ main(int argc, char *argv[]) .ysubname(1, "y1") ; + s17 + .functor(testfunc) + .name("Stat17") + .desc("this is stat 17") + ; + + TestClass testclass; + s18 + .functor(testclass) + .name("Stat18") + .desc("this is stat 18") + ; + + f1 .name("Formula1") .desc("this is formula 1") @@ -275,29 +292,17 @@ main(int argc, char *argv[]) ; f4 - .functor(testfunc) .name("Formula4") .desc("this is formula 4") ; - TestClass testclass; - f5 - .functor(testclass) - .name("Formula5") - .desc("this is formula 5") - ; - - f6 - .name("Formula6") - .desc("this is formula 6") - ; f1 = s1 + s2; f2 = (-s1) / (-s2) * (-s3 + ULL(100) + s4); f3 = sum(s5) * s7; - f6 += constant(10.0); - f6 += s5[3]; - f7 = constant(1); + f4 += constant(10.0); + f4 += s5[3]; + f5 = constant(1); check(); reset(); |