summaryrefslogtreecommitdiff
path: root/src/statwrapper.cc
diff options
context:
space:
mode:
authorDongdong Li <[email protected]>2013-08-08 00:15:58 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:50:58 -0700
commit7f49fe9feb174d34efc2a011bad79b38522a360b (patch)
treeab5b7b66e40315a81871acbf386722981020f866 /src/statwrapper.cc
parent5f91e7435742bab74dfbeca18afc63e466498f36 (diff)
Intesim2 Integration
Details: See Review 80001 https://gpgpu-sim-code-review.appspot.com/80001/ [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16747]
Diffstat (limited to 'src/statwrapper.cc')
-rw-r--r--src/statwrapper.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/statwrapper.cc b/src/statwrapper.cc
new file mode 100644
index 0000000..e273e78
--- /dev/null
+++ b/src/statwrapper.cc
@@ -0,0 +1,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
+
+