diff options
author | Nathan Binkert <binkertn@umich.edu> | 2003-12-24 03:25:36 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2003-12-24 03:25:36 -0500 |
commit | 55d94ba2e8d0375504f0a6e61d46c9ddc5b8b5d3 (patch) | |
tree | f7de5f53ead518febe9a9a018043e78f5ae3d646 /test/stattest.cc | |
parent | 3f5ca9e5e81cb921e10ba395f74a6fadd793525c (diff) | |
download | gem5-55d94ba2e8d0375504f0a6e61d46c9ddc5b8b5d3.tar.xz |
Add python output support to the statistics package!
base/statistics.cc:
base/statistics.hh:
- add python output support to the statistics package
- each statistic type has a python() member function that takes
a Python object to which the stat will output it's python
representation
- add getStatData hack so that the StatData pointer can be looked
up by the proxies with their opaque pointer to the stat they're
proxying for. This is necessary because the proxy really proxies
for the bin and not the stat. Be nice to figure out how to get
rid of it. The hack is used so that the str() function of a
proxy can properly name itself.
- To print formula stats, every stat has a str() function that
converts that stat to a string that python can execute to get
a value.
test/Makefile:
add python stuff
test/stattest.cc:
add more tests and test python support
--HG--
extra : convert_revision : 513814ab0a125606897f2c57dccdf22879032ef9
Diffstat (limited to 'test/stattest.cc')
-rw-r--r-- | test/stattest.cc | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/test/stattest.cc b/test/stattest.cc index 7c171be80..d4ae5d1fd 100644 --- a/test/stattest.cc +++ b/test/stattest.cc @@ -28,6 +28,7 @@ #include <iomanip> #include <iostream> +#include <fstream> #include <string> #include <unistd.h> @@ -48,7 +49,7 @@ Average<> s3; Scalar<Counter, MainBin> s4; Vector<Counter, MainBin> s5; Distribution<Counter, MainBin> s6; -Vector<> s7; +Vector<Counter, MainBin> s7; AverageVector<> s8; StandardDeviation<> s9; AverageDeviation<> s10; @@ -65,6 +66,7 @@ Formula f3; Formula f4; Formula f5; Formula f6; +Formula f7; MainBin bin1("bin1"); MainBin bin2("bin2"); @@ -131,7 +133,7 @@ main(int argc, char *argv[]) s3 .name("Stat03") .desc("this is statistic 3") - .prereq(s11) + .prereq(f7) ; s4 @@ -253,18 +255,20 @@ main(int argc, char *argv[]) .desc("this is formula 6") ; - check(); - - bin1.activate(); - f1 = s1 + s2; - f2 = (-s1) / (-s2) * -s3 + ULL(100) + s4; + f2 = (-s1) / (-s2) * (-s3 + ULL(100) + s4); f3 = sum(s5) * s7; f4 = functor(testfunc); TestClass testclass; f5 = functor(testclass); f6 += constant(10.0); f6 += s5[3]; + f7 = constant(1); + + check(); + reset(); + + bin1.activate(); s16[1][0] = 1; s16[0][1] = 3; @@ -477,6 +481,14 @@ main(int argc, char *argv[]) s6.sample(99); s6.sample(99); + s7[0] = 700; + s7[1] = 600; + s7[2] = 500; + s7[3] = 400; + s7[4] = 300; + s7[5] = 200; + s7[6] = 100; + s9.sample(100); s9.sample(100); s9.sample(100); @@ -497,20 +509,11 @@ main(int argc, char *argv[]) s12.sample(100); - bin1.activate(); - cout << "dump 1" << endl; - dump(cout); - cout << endl << endl; +// dump(cout, mode_simplescalar); + ofstream file("/tmp/stats.py"); + dump(file, "stattest", mode_python); + file.close(); - bin2.activate(); - cout << "dump 2" << endl; - dump(cout); - cout << endl << endl; - - cout << "dump 3" << endl; - reset(); - dump(cout); - cout << endl << endl; return 0; } |