summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorPrakash Ramrakhyani <Prakash.Ramrakhyani@arm.com>2012-01-09 18:08:20 -0600
committerPrakash Ramrakhyani <Prakash.Ramrakhyani@arm.com>2012-01-09 18:08:20 -0600
commit51aa7e4a0392d5e8f98bd7a4d09f4026dd21bd0a (patch)
tree4a93fd0bdfd9e4403053e10ac329500649216f08 /src/base
parent525d1e46dcb3180c8d73996adc025ce255575bd7 (diff)
downloadgem5-51aa7e4a0392d5e8f98bd7a4d09f4026dd21bd0a.tar.xz
sim: Enable sampling of run-time for code-sections marked using pseudo insts.
This patch adds a mechanism to collect run time samples for specific portions of a benchmark, using work_begin and work_end pseudo instructions.It also enhances the histogram stat to report geometric mean.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/statistics.hh5
-rw-r--r--src/base/stats/info.hh1
-rw-r--r--src/base/stats/text.cc6
3 files changed, 12 insertions, 0 deletions
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index d98c79414..1f8a59326 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -1477,6 +1477,8 @@ class HistStor
/** The current sum. */
Counter sum;
+ /** The sum of logarithm of each sample, used to compute geometric mean. */
+ Counter logs;
/** The sum of squares. */
Counter squares;
/** The number of samples. */
@@ -1528,6 +1530,7 @@ class HistStor
sum += val * number;
squares += val * val * number;
+ logs += log(val) * number;
samples += number;
}
@@ -1567,6 +1570,7 @@ class HistStor
data.cvec[i] = cvec[i];
data.sum = sum;
+ data.logs = logs;
data.squares = squares;
data.samples = samples;
}
@@ -1589,6 +1593,7 @@ class HistStor
sum = Counter();
squares = Counter();
samples = Counter();
+ logs = Counter();
}
};
diff --git a/src/base/stats/info.hh b/src/base/stats/info.hh
index 2c5b44a38..98e811747 100644
--- a/src/base/stats/info.hh
+++ b/src/base/stats/info.hh
@@ -183,6 +183,7 @@ struct DistData
VCounter cvec;
Counter sum;
Counter squares;
+ Counter logs;
Counter samples;
};
diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc
index 683ba7fe4..4cf98ca9e 100644
--- a/src/base/stats/text.cc
+++ b/src/base/stats/text.cc
@@ -367,6 +367,12 @@ DistPrint::operator()(ostream &stream) const
print.value = data.samples ? data.sum / data.samples : NAN;
print(stream);
+ if (data.type == Hist) {
+ print.name = base + "gmean";
+ print.value = data.samples ? exp(data.logs / data.samples) : NAN;
+ print(stream);
+ }
+
Result stdev = NAN;
if (data.samples)
stdev = sqrt((data.samples * data.squares - data.sum * data.sum) /