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

Unified Diff: base/task_scheduler/task_tracker.cc

Issue 2839333002: Record the TaskLatency Histogram in Microseconds Instead of Milliseconds (Closed)
Patch Set: CR Feedback 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
« no previous file with comments | « no previous file | base/task_scheduler/task_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a8fbfcac856d1ccca41dc61a0921841d52102b7f 100644
--- a/base/task_scheduler/task_tracker.cc
+++ b/base/task_scheduler/task_tracker.cc
@@ -74,11 +74,15 @@ 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. The minimums
+ // and maximums were chosen to place the 1ms mark at around the 70% range
+ // coverage for buckets giving us good info for tasks that have a latency
+ // below 1ms (most of them) and enough info to assess how bad the latency is
+ // for tasks that exceed this threshold.
+ return Histogram::FactoryGet(
+ std::string("TaskScheduler.TaskLatencyMicroseconds.") + suffix, 1, 20000,
+ 50, HistogramBase::kUmaTargetedHistogramFlag);
}
// Upper bound for the
@@ -495,7 +499,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698