1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
//a Wraper function for stats class
#include "intersim2/stats.hpp"
#include <stdio.h>
Stats* StatCreate (const char * name, double bin_size, int num_bins) {
Stats* newstat = new Stats(NULL,name,bin_size,num_bins);
newstat->Clear ();
return newstat;
}
void StatClear(void * st)
{
((Stats *)st)->Clear();
}
void StatAddSample (void * st, int val)
{
((Stats *)st)->AddSample(val);
}
double StatAverage(void * st)
{
return((Stats *)st)->Average();
}
double StatMax(void * st)
{
return((Stats *)st)->Max();
}
double StatMin(void * st)
{
return((Stats *)st)->Min();
}
void StatDisp (void * st)
{
printf ("Stats for ");
((Stats *)st)->DisplayHierarchy();
// if (((Stats *)st)->NeverUsed()) {
// printf (" was never updated!\n");
// } else {
printf("Min %f Max %f Average %f \n",((Stats *)st)->Min(),((Stats *)st)->Max(),StatAverage(st));
((Stats *)st)->Display();
// }
}
#if 0
int main ()
{
void * mytest = StatCreate("Test",1,5);
StatAddSample(mytest,4);
StatAddSample(mytest,4);StatAddSample(mytest,4);
StatAddSample(mytest,2);
StatDisp(mytest);
}
#endif
|