summaryrefslogtreecommitdiff
path: root/src/profiledata.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/profiledata.cc')
-rw-r--r--src/profiledata.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/profiledata.cc b/src/profiledata.cc
index e622b28..873100e 100644
--- a/src/profiledata.cc
+++ b/src/profiledata.cc
@@ -190,13 +190,25 @@ void ProfileData::Stop() {
// Dump "/proc/self/maps" so we get list of mapped shared libraries
DumpProcSelfMaps(out_);
- close(out_);
+ Reset();
fprintf(stderr, "PROFILE: interrupts/evictions/bytes = %d/%d/%" PRIuS "\n",
count_, evictions_, total_bytes_);
+}
+
+void ProfileData::Reset() {
+ if (!enabled()) {
+ return;
+ }
+
+ // Don't reset count_, evictions_, or total_bytes_ here. They're used
+ // by Stop to print information about the profile after reset, and are
+ // cleared by Start when starting a new profile.
+ close(out_);
delete[] hash_;
hash_ = 0;
delete[] evict_;
evict_ = 0;
+ num_evicted_ = 0;
free(fname_);
fname_ = 0;
start_time_ = 0;