[M108 Migration][VD] Avoid pending frame counter becoming negative
[platform/framework/web/chromium-efl.git] / cc / metrics / event_latency_tracing_recorder.h
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.
4
5 #ifndef CC_METRICS_EVENT_LATENCY_TRACING_RECORDER_H_
6 #define CC_METRICS_EVENT_LATENCY_TRACING_RECORDER_H_
7
8 #include <vector>
9
10 #include "base/time/time.h"
11 #include "cc/metrics/compositor_frame_reporter.h"
12
13 namespace cc {
14 class EventMetrics;
15
16 class EventLatencyTracingRecorder {
17  public:
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);
23
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);
29
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);
34
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);
40 };
41
42 }  // namespace cc
43
44 #endif  // CC_METRICS_EVENT_LATENCY_TRACING_RECORDER_H_