Index: base/task_scheduler/task_tracker.h |
diff --git a/base/task_scheduler/task_tracker.h b/base/task_scheduler/task_tracker.h |
index a5caf213985ea20bd986cafb70bea32d76891207..14ca1f419329dc9cb890eab9e9693f5419d8d250 100644 |
--- a/base/task_scheduler/task_tracker.h |
+++ b/base/task_scheduler/task_tracker.h |
@@ -21,13 +21,15 @@ |
namespace base { |
class ConditionVariable; |
+class HistogramBase; |
class SequenceToken; |
namespace internal { |
// All tasks go through the scheduler's TaskTracker when they are posted and |
-// when they are executed. The TaskTracker enforces shutdown semantics and takes |
-// care of tracing and profiling. This class is thread-safe. |
+// when they are executed. The TaskTracker sets up the environment to run tasks, |
+// enforces shutdown semantics, records metrics, and takes care of tracing and |
+// profiling. This class is thread-safe. |
class BASE_EXPORT TaskTracker { |
public: |
TaskTracker(); |
@@ -106,6 +108,10 @@ class BASE_EXPORT TaskTracker { |
// it reaches zero. |
void DecrementNumPendingUndelayedTasks(); |
+ // Records the TaskScheduler.TaskLatency.[task priority].[may block] histogram |
+ // for |task|. |
+ void RecordTaskLatencyHistogram(Task* task); |
+ |
// Number of tasks blocking shutdown and boolean indicating whether shutdown |
// has started. |
const std::unique_ptr<State> state_; |
@@ -133,6 +139,12 @@ class BASE_EXPORT TaskTracker { |
// completes. |
std::unique_ptr<WaitableEvent> shutdown_event_; |
+ // TaskScheduler.TaskLatency.[task priority].[may block] histograms. The first |
+ // index is a TaskPriority. The second index is 0 for non-blocking tasks, 1 |
+ // for blocking tasks. Intentionally leaked. |
+ HistogramBase* const |
+ task_latency_histograms_[static_cast<int>(TaskPriority::HIGHEST) + 1][2]; |
+ |
// Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |