5#ifndef FLUTTER_FLOW_FRAME_TIMINGS_H_
6#define FLUTTER_FLOW_FRAME_TIMINGS_H_
10#include "flutter/common/settings.h"
11#include "flutter/flow/raster_cache.h"
12#include "flutter/fml/macros.h"
13#include "flutter/fml/status.h"
14#include "flutter/fml/time/time_delta.h"
15#include "flutter/fml/time/time_point.h"
17#define TRACE_EVENT_WITH_FRAME_NUMBER(recorder, category_group, name, \
18 flow_id_count, flow_ids) \
19 TRACE_EVENT1_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids, \
21 recorder->GetFrameNumberTraceArg())
130 FML_FRIEND_TEST(FrameTimingsRecorderTest, ThrowWhenRecordBuildBeforeVsync);
131 FML_FRIEND_TEST(FrameTimingsRecorderTest,
132 ThrowWhenRecordRasterBeforeBuildEnd);
140 static std::atomic<uint64_t> frame_number_gen_;
142 mutable std::mutex state_mutex_;
145 const uint64_t frame_number_;
146 const std::string frame_number_trace_arg_val_;
156 size_t layer_cache_count_;
157 size_t layer_cache_bytes_;
158 size_t picture_cache_count_;
159 size_t picture_cache_bytes_;
void RecordBuildStart(fml::TimePoint build_start)
Records a build start event.
FrameTiming RecordRasterEnd(const RasterCache *cache=nullptr)
fml::TimePoint GetVsyncStartTime() const
Timestamp of the vsync signal.
fml::TimePoint GetBuildEndTime() const
Timestamp of when the frame was finished building.
fml::TimePoint GetRasterEndTime() const
Timestamp of when the frame rasterization finished.
void RecordRasterStart(fml::TimePoint raster_start)
Records a raster start event.
std::unique_ptr< FrameTimingsRecorder > CloneUntil(State state)
Clones the recorder until (and including) the specified state.
void AssertInState(State state) const
size_t GetPictureCacheCount() const
Count of the picture cache entries.
fml::TimePoint GetRasterEndWallTime() const
Timestamp of when the frame rasterization is complete in wall-time.
size_t GetLayerCacheBytes() const
Total Bytes in all layer cache entries.
void RecordVsync(fml::TimePoint vsync_start, fml::TimePoint vsync_target)
Records a vsync event.
fml::TimePoint GetVsyncTargetTime() const
size_t GetPictureCacheBytes() const
Total Bytes in all picture cache entries.
size_t GetLayerCacheCount() const
Count of the layer cache entries.
void RecordBuildEnd(fml::TimePoint build_end)
Records a build end event.
FrameTimingsRecorder()
Default constructor, initializes the recorder with State::kUninitialized.
fml::TimePoint GetBuildStartTime() const
Timestamp of when the frame building started.
const char * GetFrameNumberTraceArg() const
Returns the frame number in a fml tracing friendly format.
fml::TimePoint GetRasterStartTime() const
Timestamp of when the frame rasterization started.
uint64_t GetFrameNumber() const
FrameTiming GetRecordedTime() const
Returns the recorded time from when RecordRasterEnd is called.
fml::TimeDelta GetBuildDuration() const
Duration of the frame build time.
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache