Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2210)

Unified Diff: src/counters.cc

Issue 14471007: Remove Isolate::Current() from histograms. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/counters.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.cc
diff --git a/src/counters.cc b/src/counters.cc
index 7c8265e9818e5e199101cf6d927d43642378531e..fa192baed21904b77f81fa8cb9592ae26d105311 100644
--- a/src/counters.cc
+++ b/src/counters.cc
@@ -45,57 +45,38 @@ int* StatsCounter::FindLocationInStatsTable() const {
}
-// Start the timer.
-void StatsCounterTimer::Start() {
- if (!counter_.Enabled())
- return;
- stop_time_ = 0;
- start_time_ = OS::Ticks();
-}
-
-// Stop the timer and record the results.
-void StatsCounterTimer::Stop() {
- if (!counter_.Enabled())
- return;
- stop_time_ = OS::Ticks();
-
- // Compute the delta between start and stop, in milliseconds.
- int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000;
- counter_.Increment(milliseconds);
-}
-
void Histogram::AddSample(int sample) {
if (Enabled()) {
- Isolate::Current()->stats_table()->AddHistogramSample(histogram_, sample);
+ isolate()->stats_table()->AddHistogramSample(histogram_, sample);
}
}
void* Histogram::CreateHistogram() const {
- return Isolate::Current()->stats_table()->
+ return isolate()->stats_table()->
CreateHistogram(name_, min_, max_, num_buckets_);
}
// Start the timer.
void HistogramTimer::Start() {
- if (histogram_.Enabled()) {
+ if (Enabled()) {
stop_time_ = 0;
start_time_ = OS::Ticks();
}
if (FLAG_log_internal_timer_events) {
- LOG(Isolate::Current(), TimerEvent(Logger::START, histogram_.name_));
+ LOG(isolate(), TimerEvent(Logger::START, name()));
}
}
// Stop the timer and record the results.
void HistogramTimer::Stop() {
- if (histogram_.Enabled()) {
+ if (Enabled()) {
stop_time_ = OS::Ticks();
// Compute the delta between start and stop, in milliseconds.
int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000;
- histogram_.AddSample(milliseconds);
+ AddSample(milliseconds);
}
if (FLAG_log_internal_timer_events) {
- LOG(Isolate::Current(), TimerEvent(Logger::END, histogram_.name_));
+ LOG(isolate(), TimerEvent(Logger::END, name()));
}
}
« no previous file with comments | « src/counters.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698