@@ -82,6 +82,20 @@ class TimelineSummary {
82
82
return _averageInMillis (_extractGpuRasterizerDrawDurations ());
83
83
}
84
84
85
+ /// Standard deviation amount of time spent per frame in the engine rasterizer.
86
+ ///
87
+ /// Throws a [StateError] if this summary contains no timeline events.
88
+ double computeStandardDeviationFrameRasterizerTimeMillis () {
89
+ final List <Duration > durations = _extractGpuRasterizerDrawDurations ();
90
+ final double average = _averageInMillis (durations);
91
+ double tally = 0.0 ;
92
+ for (final Duration duration in durations) {
93
+ final double time = duration.inMicroseconds.toDouble () / 1000.0 ;
94
+ tally += (average - time).abs ();
95
+ }
96
+ return tally / durations.length;
97
+ }
98
+
85
99
/// The longest frame rasterization time in milliseconds.
86
100
///
87
101
/// Throws a [StateError] if this summary contains no timeline events.
@@ -146,6 +160,9 @@ class TimelineSummary {
146
160
/// * "average_frame_rasterizer_time_millis": Average amount of time spent
147
161
/// per frame in the engine rasterizer.
148
162
/// See [computeAverageFrameRasterizerTimeMillis] .
163
+ /// * "stddev_frame_rasterizer_time_millis": Standard deviation of the amount
164
+ /// of time spent per frame in the engine rasterizer.
165
+ /// See [computeStandardDeviationFrameRasterizerTimeMillis] .
149
166
/// * "90th_percentile_frame_rasterizer_time_millis" and
150
167
/// "99th_percentile_frame_rasterizer_time_millis": The 90/99-th percentile
151
168
/// frame rasterization time in milliseconds.
@@ -240,6 +257,7 @@ class TimelineSummary {
240
257
'worst_frame_build_time_millis' : computeWorstFrameBuildTimeMillis (),
241
258
'missed_frame_build_budget_count' : computeMissedFrameBuildBudgetCount (),
242
259
'average_frame_rasterizer_time_millis' : computeAverageFrameRasterizerTimeMillis (),
260
+ 'stddev_frame_rasterizer_time_millis' : computeStandardDeviationFrameRasterizerTimeMillis (),
243
261
'90th_percentile_frame_rasterizer_time_millis' : computePercentileFrameRasterizerTimeMillis (90.0 ),
244
262
'99th_percentile_frame_rasterizer_time_millis' : computePercentileFrameRasterizerTimeMillis (99.0 ),
245
263
'worst_frame_rasterizer_time_millis' : computeWorstFrameRasterizerTimeMillis (),
0 commit comments