changeset cf9fb00b6aad in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=cf9fb00b6aad
description:
        stats: Add stats unittest for total calculations.

diffstat:

 src/unittest/stattest.cc |  41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

diffs (88 lines):

diff -r a1104cc13db2 -r cf9fb00b6aad src/unittest/stattest.cc
--- a/src/unittest/stattest.cc  Tue Jun 05 01:23:09 2012 -0400
+++ b/src/unittest/stattest.cc  Tue Jun 05 01:23:10 2012 -0400
@@ -94,27 +94,37 @@
     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 @@
         .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 @@
     f4 += constant(10.0);
     f4 += s5[3];
     f5 = constant(1);
+    f6 = s19/s20;
 }
 
 void
@@ -634,4 +663,10 @@
     for (int i = 0; i < 1000; i++) {
         sh1.sample(random() % 10000);
     }
+
+    s19[0] = 1;
+    s19[1] = 100000;
+    s20[0] = 100000;
+    s20[1] = 1;
+
 }
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to