@@ -58,12 +58,15 @@ class FrameTimingSummarizer {
58
58
final List <Duration > frameBuildTime = List <Duration >.unmodifiable (
59
59
data.map <Duration >((FrameTiming datum) => datum.buildDuration),
60
60
);
61
- final List <Duration > frameBuildTimeSorted = List <Duration >.from (frameBuildTime)..sort ();
61
+ final List <Duration > frameBuildTimeSorted =
62
+ List <Duration >.from (frameBuildTime)..sort ();
62
63
final List <Duration > frameRasterizerTime = List <Duration >.unmodifiable (
63
64
data.map <Duration >((FrameTiming datum) => datum.rasterDuration),
64
65
);
65
- final List <Duration > frameRasterizerTimeSorted = List <Duration >.from (frameRasterizerTime)..sort ();
66
- final Duration Function (Duration , Duration ) add = (Duration a, Duration b) => a + b;
66
+ final List <Duration > frameRasterizerTimeSorted =
67
+ List <Duration >.from (frameRasterizerTime)..sort ();
68
+ final Duration Function (Duration , Duration ) add =
69
+ (Duration a, Duration b) => a + b;
67
70
return FrameTimingSummarizer ._(
68
71
frameBuildTime: frameBuildTime,
69
72
frameRasterizerTime: frameRasterizerTime,
@@ -74,11 +77,13 @@ class FrameTimingSummarizer {
74
77
p99FrameBuildTime: _findPercentile (frameBuildTimeSorted, 0.99 ),
75
78
worstFrameBuildTime: frameBuildTimeSorted.last,
76
79
missedFrameBuildBudget: _countExceed (frameBuildTimeSorted, kBuildBudget),
77
- averageFrameRasterizerTime: frameRasterizerTime.reduce (add) ~ / data.length,
80
+ averageFrameRasterizerTime:
81
+ frameRasterizerTime.reduce (add) ~ / data.length,
78
82
p90FrameRasterizerTime: _findPercentile (frameRasterizerTimeSorted, 0.90 ),
79
83
p99FrameRasterizerTime: _findPercentile (frameRasterizerTimeSorted, 0.99 ),
80
84
worstFrameRasterizerTime: frameRasterizerTimeSorted.last,
81
- missedFrameRasterizerBudget: _countExceed (frameRasterizerTimeSorted, kBuildBudget),
85
+ missedFrameRasterizerBudget:
86
+ _countExceed (frameRasterizerTimeSorted, kBuildBudget),
82
87
);
83
88
}
84
89
@@ -94,7 +99,7 @@ class FrameTimingSummarizer {
94
99
@required this .p90FrameRasterizerTime,
95
100
@required this .p99FrameRasterizerTime,
96
101
@required this .worstFrameRasterizerTime,
97
- @required this .missedFrameRasterizerBudget
102
+ @required this .missedFrameRasterizerBudget,
98
103
});
99
104
100
105
/// List of frame build time in microseconds
@@ -137,30 +142,32 @@ class FrameTimingSummarizer {
137
142
///
138
143
/// See [TimelineSummary.summaryJson] for detail.
139
144
Map <String , dynamic > get summary => < String , dynamic > {
140
- 'average_frame_build_time_millis' :
141
- averageFrameBuildTime.inMicroseconds / 1E3 ,
142
- '90th_percentile_frame_build_time_millis' :
143
- p90FrameBuildTime.inMicroseconds / 1E3 ,
144
- '99th_percentile_frame_build_time_millis' :
145
- p99FrameBuildTime.inMicroseconds / 1E3 ,
146
- 'worst_frame_build_time_millis' :
147
- worstFrameBuildTime.inMicroseconds / 1E3 ,
148
- 'missed_frame_build_budget_count' : missedFrameBuildBudget,
149
- 'average_frame_rasterizer_time_millis' :
150
- averageFrameRasterizerTime.inMicroseconds / 1E3 ,
151
- '90th_percentile_frame_rasterizer_time_millis' :
152
- p90FrameRasterizerTime.inMicroseconds / 1E3 ,
153
- '99th_percentile_frame_rasterizer_time_millis' :
154
- p99FrameRasterizerTime.inMicroseconds / 1E3 ,
155
- 'worst_frame_rasterizer_time_millis' :
156
- worstFrameRasterizerTime.inMicroseconds / 1E3 ,
157
- 'missed_frame_rasterizer_budget_count' : missedFrameRasterizerBudget,
158
- 'frame_count' : frameBuildTime.length,
159
- 'frame_build_times' : frameBuildTime
160
- .map <int >((Duration datum) => datum.inMicroseconds).toList (),
161
- 'frame_rasterizer_times' : frameRasterizerTime
162
- .map <int >((Duration datum) => datum.inMicroseconds).toList (),
163
- };
145
+ 'average_frame_build_time_millis' :
146
+ averageFrameBuildTime.inMicroseconds / 1E3 ,
147
+ '90th_percentile_frame_build_time_millis' :
148
+ p90FrameBuildTime.inMicroseconds / 1E3 ,
149
+ '99th_percentile_frame_build_time_millis' :
150
+ p99FrameBuildTime.inMicroseconds / 1E3 ,
151
+ 'worst_frame_build_time_millis' :
152
+ worstFrameBuildTime.inMicroseconds / 1E3 ,
153
+ 'missed_frame_build_budget_count' : missedFrameBuildBudget,
154
+ 'average_frame_rasterizer_time_millis' :
155
+ averageFrameRasterizerTime.inMicroseconds / 1E3 ,
156
+ '90th_percentile_frame_rasterizer_time_millis' :
157
+ p90FrameRasterizerTime.inMicroseconds / 1E3 ,
158
+ '99th_percentile_frame_rasterizer_time_millis' :
159
+ p99FrameRasterizerTime.inMicroseconds / 1E3 ,
160
+ 'worst_frame_rasterizer_time_millis' :
161
+ worstFrameRasterizerTime.inMicroseconds / 1E3 ,
162
+ 'missed_frame_rasterizer_budget_count' : missedFrameRasterizerBudget,
163
+ 'frame_count' : frameBuildTime.length,
164
+ 'frame_build_times' : frameBuildTime
165
+ .map <int >((Duration datum) => datum.inMicroseconds)
166
+ .toList (),
167
+ 'frame_rasterizer_times' : frameRasterizerTime
168
+ .map <int >((Duration datum) => datum.inMicroseconds)
169
+ .toList (),
170
+ };
164
171
}
165
172
166
173
// The following helper functions require data sorted
@@ -173,5 +180,6 @@ T _findPercentile<T>(List<T> data, double p) {
173
180
174
181
// return the number of items in data that > threshold
175
182
int _countExceed <T extends Comparable <T >>(List <T > data, T threshold) {
176
- return data.length - data.indexWhere ((T datum) => datum.compareTo (threshold) > 0 );
183
+ return data.length -
184
+ data.indexWhere ((T datum) => datum.compareTo (threshold) > 0 );
177
185
}
0 commit comments