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

Unified Diff: base/task_scheduler/task_tracker.cc

Issue 2839333002: Record the TaskLatency Histogram in Microseconds Instead of Milliseconds (Closed)
Patch Set: Created 3 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
Index: base/task_scheduler/task_tracker.cc
diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc
index da21d5ea8ef510c33636cc993b34e3501aa09101..5dad684e1805e96c06e47de8a01cbdff09342552 100644
--- a/base/task_scheduler/task_tracker.cc
+++ b/base/task_scheduler/task_tracker.cc
@@ -74,11 +74,11 @@ const char kQueueFunctionName[] = "base::PostTask";
const char kRunFunctionName[] = "TaskSchedulerRunTask";
HistogramBase* GetTaskLatencyHistogram(const char* suffix) {
- // Mimics the UMA_HISTOGRAM_TIMES macro.
- return Histogram::FactoryTimeGet(
- std::string("TaskScheduler.TaskLatency.") + suffix,
- TimeDelta::FromMilliseconds(1), TimeDelta::FromSeconds(10), 50,
- HistogramBase::kUmaTargetedHistogramFlag);
+ // Mimics the UMA_HISTOGRAM_TIMES macro except we don't specify bounds with
+ // TimeDeltas as FactoryTimeGet assumes millisecond granularity.
+ return Histogram::FactoryGet(
+ std::string("TaskScheduler.TaskLatencyMicroseconds.") + suffix, 1, 2000,
+ 50, HistogramBase::kUmaTargetedHistogramFlag);
Ilya Sherman 2017/04/27 21:24:01 While you're here, would you mind updating this co
robliao 2017/04/27 21:42:22 UmaHistogramTimes starts at 1ms minimum time sampl
Ilya Sherman 2017/04/27 21:50:35 Yes, sorry, you're right. I meant UmaHistogramCus
robliao 2017/04/27 21:54:49 UmaHistogramCustomTimes -> HistogramBase* histogr
Ilya Sherman 2017/04/27 21:56:45 Ah, I see. How about UmaHistogramCustomCounts? I
robliao 2017/04/27 22:07:44 Gotcha. We also keep the histogram around so we do
}
// Upper bound for the
@@ -495,7 +495,7 @@ void TaskTracker::RecordTaskLatencyHistogram(Task* task) {
task->traits.with_base_sync_primitives()
? 1
: 0]
- ->AddTime(task_latency);
+ ->Add(task_latency.InMicroseconds());
}
} // namespace internal
« no previous file with comments | « no previous file | base/task_scheduler/task_tracker_unittest.cc » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698