Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3bbc2a6

Browse files
committed
add comments
1 parent cedb4a3 commit 3bbc2a6

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

flow/frame_timings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fml::TimeDelta FrameTimingsRecorder::GetBuildDuration() const {
6060
void FrameTimingsRecorder::RecordVsync(fml::TimePoint vsync_start,
6161
fml::TimePoint vsync_target) {
6262
std::scoped_lock state_lock(state_mutex_);
63-
FML_CHECK(state_ == State::kUnitialized);
63+
FML_CHECK(state_ == State::kUninitialized);
6464
state_ = State::kVsync;
6565
vsync_start_ = vsync_start;
6666
vsync_target_ = vsync_target;

flow/frame_timings.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,73 @@
1414

1515
namespace flutter {
1616

17+
/// Records timestamps for various phases of a frame rendering process.
18+
///
19+
/// Recorder is created on vsync and destroyed after the rasterization of the
20+
/// frame.
1721
class FrameTimingsRecorder {
1822
public:
23+
/// Various states that the recorder can be in. When created the recorder is
24+
/// in an unitialized state and transtions in sequential order of the states.
1925
enum class State : uint32_t {
20-
kUnitialized = 1,
26+
kUninitialized = 1,
2127
kVsync = 2,
2228
kBuildStart = 3,
2329
kBuildEnd = 4,
2430
kRasterStart = 5,
2531
kRasterEnd = 6,
2632
};
2733

34+
/// Default constructor, initializes the recorder with State::kUninitialized.
2835
FrameTimingsRecorder();
2936

3037
~FrameTimingsRecorder();
3138

39+
/// Timestamp of the vsync signal.
3240
fml::TimePoint GetVsyncStartTime() const;
3341

42+
/// Timestamp of when the frame was targeted to be presented.
43+
///
44+
/// This is typically the next vsync signal timestamp.
3445
fml::TimePoint GetVsyncTargetTime() const;
3546

47+
/// Timestamp of when the frame building started.
3648
fml::TimePoint GetBuildStartTime() const;
3749

50+
/// Timestamp of when the frame was finished building.
3851
fml::TimePoint GetBuildEndTime() const;
3952

53+
/// Timestamp of when the frame rasterization started.
4054
fml::TimePoint GetRasterStartTime() const;
4155

56+
/// Timestamp of when the frame rasterization finished.
4257
fml::TimePoint GetRasterEndTime() const;
4358

59+
/// Duration of the frame build time.
4460
fml::TimeDelta GetBuildDuration() const;
4561

62+
/// Records a vsync event.
4663
void RecordVsync(fml::TimePoint vsync_start, fml::TimePoint vsync_target);
4764

65+
/// Records a build start event.
4866
void RecordBuildStart(fml::TimePoint build_start);
4967

68+
/// Records a build end event.
5069
void RecordBuildEnd(fml::TimePoint build_end);
5170

71+
/// Records a raster start event.
5272
void RecordRasterStart(fml::TimePoint raster_start);
5373

74+
/// Clones the recorder until (and including) the specified state.
5475
std::unique_ptr<FrameTimingsRecorder> CloneUntil(State state);
5576

77+
/// Records a raster end event, and builds a `FrameTiming` that summarizes all
78+
/// the events. This summary is sent to the framework.
5679
FrameTiming RecordRasterEnd(fml::TimePoint raster_end);
5780

5881
private:
5982
mutable std::mutex state_mutex_;
60-
State state_ = State::kUnitialized;
83+
State state_ = State::kUninitialized;
6184

6285
fml::TimePoint vsync_start_ = fml::TimePoint::Min();
6386
fml::TimePoint vsync_target_ = fml::TimePoint::Min();

0 commit comments

Comments
 (0)