2 * Copyright (c) 2003 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #include "base/cprintf.hh"
36 #include "base/misc.hh"
37 #include "base/statistics.hh"
38 #include "sim/host.hh"
41 using namespace Statistics
;
44 Tick ticksPerSecond
= ULL(2000000000);
49 Scalar
<Counter
, MainBin
> s4
;
50 Vector
<Counter
, MainBin
> s5
;
51 Distribution
<Counter
, MainBin
> s6
;
52 Vector
<Counter
, MainBin
> s7
;
54 StandardDeviation
<> s9
;
55 AverageDeviation
<> s10
;
58 VectorDistribution
<> s13
;
59 VectorStandardDeviation
<> s14
;
60 VectorAverageDeviation
<> s15
;
82 double operator()() { return 9.7; }
90 panic("incorrect usage.\n"
92 "\t%s [-v]\n", progname
);
96 main(int argc
, char *argv
[])
100 PrintDescriptions
= false;
101 while ((c
= getopt(argc
, argv
, "v")) != -1) {
102 cprintf("c == %c\n", c
);
105 PrintDescriptions
= true;
116 s12
.init(1, 100, 13);
117 s13
.init(4, 0, 99, 10);
124 .desc("this is statistic 1")
129 .desc("this is statistic 2")
135 .desc("this is statistic 3")
141 .desc("this is statistic 4")
147 .desc("this is statistic 5")
158 .desc("this is statistic 6")
164 .desc("this is statistic 7")
172 .desc("this is statistic 8")
180 .desc("this is statistic 9")
187 .desc("this is statistic 10")
193 .desc("this is statistic 12")
198 .desc("this is statistic 13")
203 .desc("this is statistic 14")
208 .desc("this is statistic 15")
213 .desc("this is statistic 16")
221 .desc("this is formula 1")
227 .desc("this is formula 2")
234 .desc("this is formula 3")
245 .desc("this is formula 4")
250 .desc("this is formula 5")
255 .desc("this is formula 6")
259 f2
= (-s1
) / (-s2
) * (-s3
+ ULL(100) + s4
);
261 f4
= functor(testfunc
);
263 f5
= functor(testclass
);
264 f6
+= constant(10.0);
298 s10
.sample(1000000000);
299 curTick
+= ULL(1000000);
374 curTick
+= ULL(1000000);
376 curTick
+= ULL(1000000);
378 curTick
+= ULL(1000000);
380 curTick
+= ULL(1000000);
382 curTick
+= ULL(1000000);
389 curTick
+= ULL(1000000);
391 curTick
+= ULL(1000000);
393 curTick
+= ULL(1000000);
395 curTick
+= ULL(1000000);
398 curTick
+= ULL(1000000);
400 curTick
+= ULL(1000000);
402 curTick
+= ULL(1000000);
404 curTick
+= ULL(1000000);
410 curTick
+= ULL(1000000);
417 curTick
+= ULL(1000000);
512 // dump(cout, mode_simplescalar);
513 python_start("/tmp/stats.py");
514 python_dump("stattest", "all");