OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/task_scheduler/task_tracker.h" | 5 #include "base/task_scheduler/task_tracker.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 out->append(tmp); | 67 out->append(tmp); |
68 } | 68 } |
69 | 69 |
70 const char kQueueFunctionName[] = "base::PostTask"; | 70 const char kQueueFunctionName[] = "base::PostTask"; |
71 | 71 |
72 // This name conveys that a Task is run by the task scheduler without revealing | 72 // This name conveys that a Task is run by the task scheduler without revealing |
73 // its implementation details. | 73 // its implementation details. |
74 const char kRunFunctionName[] = "TaskSchedulerRunTask"; | 74 const char kRunFunctionName[] = "TaskSchedulerRunTask"; |
75 | 75 |
76 HistogramBase* GetTaskLatencyHistogram(const char* suffix) { | 76 HistogramBase* GetTaskLatencyHistogram(const char* suffix) { |
77 // Mimics the UMA_HISTOGRAM_TIMES macro. | 77 // Mimics the UMA_HISTOGRAM_TIMES macro except we don't specify bounds with |
78 return Histogram::FactoryTimeGet( | 78 // TimeDeltas as FactoryTimeGet assumes millisecond granularity. |
79 std::string("TaskScheduler.TaskLatency.") + suffix, | 79 return Histogram::FactoryGet( |
80 TimeDelta::FromMilliseconds(1), TimeDelta::FromSeconds(10), 50, | 80 std::string("TaskScheduler.TaskLatencyMicroseconds.") + suffix, 1, 2000, |
gab
2017/04/28 01:49:29
2000 max is merely 2ms, I think we want something
robliao
2017/04/28 17:07:53
2ms covers 89-99% of the 7 day aggregation on Wind
robliao
2017/04/28 17:18:47
Inlining gab@'s reply to the thread:
Is that true
robliao
2017/04/28 17:23:41
So for background blocking the data is approximate
robliao
2017/04/28 17:57:38
Inlining gab@'s reply to this thread:
But so long
robliao
2017/04/28 18:17:59
Longer term, I would expect these values to go dow
| |
81 HistogramBase::kUmaTargetedHistogramFlag); | 81 50, HistogramBase::kUmaTargetedHistogramFlag); |
82 } | 82 } |
83 | 83 |
84 // Upper bound for the | 84 // Upper bound for the |
85 // TaskScheduler.BlockShutdownTasksPostedDuringShutdown histogram. | 85 // TaskScheduler.BlockShutdownTasksPostedDuringShutdown histogram. |
86 const HistogramBase::Sample kMaxBlockShutdownTasksPostedDuringShutdown = 1000; | 86 const HistogramBase::Sample kMaxBlockShutdownTasksPostedDuringShutdown = 1000; |
87 | 87 |
88 void RecordNumBlockShutdownTasksPostedDuringShutdown( | 88 void RecordNumBlockShutdownTasksPostedDuringShutdown( |
89 HistogramBase::Sample value) { | 89 HistogramBase::Sample value) { |
90 UMA_HISTOGRAM_CUSTOM_COUNTS( | 90 UMA_HISTOGRAM_CUSTOM_COUNTS( |
91 "TaskScheduler.BlockShutdownTasksPostedDuringShutdown", value, 1, | 91 "TaskScheduler.BlockShutdownTasksPostedDuringShutdown", value, 1, |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 } | 488 } |
489 } | 489 } |
490 | 490 |
491 void TaskTracker::RecordTaskLatencyHistogram(Task* task) { | 491 void TaskTracker::RecordTaskLatencyHistogram(Task* task) { |
492 const TimeDelta task_latency = TimeTicks::Now() - task->sequenced_time; | 492 const TimeDelta task_latency = TimeTicks::Now() - task->sequenced_time; |
493 task_latency_histograms_[static_cast<int>(task->traits.priority())] | 493 task_latency_histograms_[static_cast<int>(task->traits.priority())] |
494 [task->traits.may_block() || | 494 [task->traits.may_block() || |
495 task->traits.with_base_sync_primitives() | 495 task->traits.with_base_sync_primitives() |
496 ? 1 | 496 ? 1 |
497 : 0] | 497 : 0] |
498 ->AddTime(task_latency); | 498 ->Add(task_latency.InMicroseconds()); |
499 } | 499 } |
500 | 500 |
501 } // namespace internal | 501 } // namespace internal |
502 } // namespace base | 502 } // namespace base |
OLD | NEW |