1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_METRICS_EVENT_LATENCY_TRACING_RECORDER_H_
6 #define CC_METRICS_EVENT_LATENCY_TRACING_RECORDER_H_
10 #include "base/time/time.h"
11 #include "cc/metrics/compositor_frame_reporter.h"
16 class EventLatencyTracingRecorder {
18 // Returns the name of the event dispatch breakdown of EventLatency trace
19 // events between `start_stage` and `end_stage`.
20 static const char* GetDispatchBreakdownName(
21 EventMetrics::DispatchStage start_stage,
22 EventMetrics::DispatchStage end_stage);
24 // Returns the name of EventLatency breakdown between `dispatch_stage` and
25 // `compositor_stage`.
26 static const char* GetDispatchToCompositorBreakdownName(
27 EventMetrics::DispatchStage dispatch_stage,
28 CompositorFrameReporter::StageType compositor_stage);
30 // Returns the name of EventLatency breakdown between `dispatch_stage` and
31 // termination for events not associated with a frame update.
32 static const char* GetDispatchToTerminationBreakdownName(
33 EventMetrics::DispatchStage dispatch_stage);
35 static void RecordEventLatencyTraceEvent(
36 EventMetrics* event_metrics,
37 base::TimeTicks termination_time,
38 const std::vector<CompositorFrameReporter::StageData>* stage_history,
39 const CompositorFrameReporter::ProcessedVizBreakdown* viz_breakdown);
44 #endif // CC_METRICS_EVENT_LATENCY_TRACING_RECORDER_H_