Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
50d42122
Unverified
Commit
50d42122
authored
Dec 27, 2019
by
Francisco Magdaleno
Committed by
GitHub
Dec 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "fix duration event of timeline summary (#47742)" (#47888)
This reverts commit
e43fd1c5
.
parent
e43fd1c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
78 deletions
+54
-78
timeline_summary.dart
packages/flutter_driver/lib/src/driver/timeline_summary.dart
+34
-13
timeline_summary_test.dart
packages/flutter_driver/test/src/timeline_summary_test.dart
+20
-65
No files found.
packages/flutter_driver/lib/src/driver/timeline_summary.dart
View file @
50d42122
...
...
@@ -57,27 +57,27 @@ class TimelineSummary {
///
/// Returns null if no frames were recorded.
double
computeAverageFrameRasterizerTimeMillis
()
{
return
_averageInMillis
(
_extract
GpuRasterizerDrawDurations
(
));
return
_averageInMillis
(
_extract
Duration
(
_extractGpuRasterizerDrawEvents
()
));
}
/// The longest frame rasterization time in milliseconds.
///
/// Returns null if no frames were recorded.
double
computeWorstFrameRasterizerTimeMillis
()
{
return
_maxInMillis
(
_extract
GpuRasterizerDrawDurations
(
));
return
_maxInMillis
(
_extract
Duration
(
_extractGpuRasterizerDrawEvents
()
));
}
/// The [p]-th percentile frame rasterization time in milliseconds.
///
/// Returns null if no frames were recorded.
double
computePercentileFrameRasterizerTimeMillis
(
double
p
)
{
return
_percentileInMillis
(
_extract
GpuRasterizerDrawDurations
(
),
p
);
return
_percentileInMillis
(
_extract
Duration
(
_extractGpuRasterizerDrawEvents
()
),
p
);
}
/// The number of frames that missed the [kBuildBudget] on the GPU and
/// therefore are in the danger of missing frames.
int
computeMissedFrameRasterizerBudgetCount
([
Duration
frameBuildBudget
=
kBuildBudget
])
=>
_extractGpuRasterizerDraw
Duration
s
()
.
where
((
Duration
duration
)
=>
duration
>
kBuildBudget
)
int
computeMissedFrameRasterizerBudgetCount
([
Duration
frameBuildBudget
=
kBuildBudget
])
=>
_extractGpuRasterizerDraw
Event
s
()
.
where
((
TimedEvent
event
)
=>
event
.
duration
>
kBuildBudget
)
.
length
;
/// The total number of frames recorded in the timeline.
...
...
@@ -100,8 +100,8 @@ class TimelineSummary {
'frame_build_times'
:
_extractFrameDurations
()
.
map
<
int
>((
Duration
duration
)
=>
duration
.
inMicroseconds
)
.
toList
(),
'frame_rasterizer_times'
:
_extractGpuRasterizerDraw
Duration
s
()
.
map
<
int
>((
Duration
duration
)
=>
duration
.
inMicroseconds
)
'frame_rasterizer_times'
:
_extractGpuRasterizerDraw
Event
s
()
.
map
<
int
>((
TimedEvent
event
)
=>
event
.
duration
.
inMicroseconds
)
.
toList
(),
};
}
...
...
@@ -142,11 +142,15 @@ class TimelineSummary {
.
toList
();
}
/// Extracts Duration list that are reported as a pair of begin/end events.
List
<
Duration
>
_extractDurations
(
String
name
)
{
return
_extractNamedEvents
(
name
).
map
<
Duration
>((
TimelineEvent
event
)
=>
event
.
duration
).
toList
();
}
/// Extracts timed events that are reported as a pair of begin/end events.
///
/// See: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU
List
<
Duration
>
_extractBeginEndEvents
(
String
name
)
{
final
List
<
Duration
>
result
=
<
Duration
>[];
List
<
TimedEvent
>
_extractBeginEndEvents
(
String
name
)
{
final
List
<
TimedEvent
>
result
=
<
TimedEvent
>[];
// Timeline does not guarantee that the first event is the "begin" event.
final
Iterator
<
TimelineEvent
>
events
=
_extractNamedEvents
(
name
)
...
...
@@ -155,7 +159,10 @@ class TimelineSummary {
final
TimelineEvent
beginEvent
=
events
.
current
;
if
(
events
.
moveNext
())
{
final
TimelineEvent
endEvent
=
events
.
current
;
result
.
add
(
Duration
(
microseconds:
endEvent
.
timestampMicros
-
beginEvent
.
timestampMicros
));
result
.
add
(
TimedEvent
(
beginEvent
.
timestampMicros
,
endEvent
.
timestampMicros
,
));
}
}
...
...
@@ -187,7 +194,21 @@ class TimelineSummary {
.
reduce
(
math
.
max
);
}
List
<
Duration
>
_extractGpuRasterizerDrawDurations
()
=>
_extractBeginEndEvents
(
'GPURasterizer::Draw'
);
List
<
TimedEvent
>
_extractGpuRasterizerDrawEvents
()
=>
_extractBeginEndEvents
(
'GPURasterizer::Draw'
);
List
<
Duration
>
_extractFrameDurations
()
=>
_extractDurations
(
'Frame'
);
Iterable
<
Duration
>
_extractDuration
(
Iterable
<
TimedEvent
>
events
)
{
return
events
.
map
<
Duration
>((
TimedEvent
e
)
=>
e
.
duration
);
}
}
/// Timing information about an event that happened in the event loop.
class
TimedEvent
{
/// Creates a timed event given begin and end timestamps in microseconds.
TimedEvent
(
int
beginTimeMicros
,
int
endTimeMicros
)
:
duration
=
Duration
(
microseconds:
endTimeMicros
-
beginTimeMicros
);
List
<
Duration
>
_extractFrameDurations
()
=>
_extractBeginEndEvents
(
'Frame'
);
/// The duration of the event.
final
Duration
duration
;
}
packages/flutter_driver/test/src/timeline_summary_test.dart
View file @
50d42122
...
...
@@ -20,16 +20,11 @@ void main() {
}));
}
Map
<
String
,
dynamic
>
frameBegin
(
int
timeStamp
)
=>
<
String
,
dynamic
>{
Map
<
String
,
dynamic
>
build
(
int
timeStamp
,
int
duration
)
=>
<
String
,
dynamic
>{
'name'
:
'Frame'
,
'ph'
:
'B'
,
'ts'
:
timeStamp
,
};
Map
<
String
,
dynamic
>
frameEnd
(
int
timeStamp
)
=>
<
String
,
dynamic
>{
'name'
:
'Frame'
,
'ph'
:
'E'
,
'ph'
:
'X'
,
'ts'
:
timeStamp
,
'dur'
:
duration
,
};
Map
<
String
,
dynamic
>
begin
(
int
timeStamp
)
=>
<
String
,
dynamic
>{
...
...
@@ -59,8 +54,8 @@ void main() {
test
(
'counts frames'
,
()
{
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameBegin
(
1000
),
frameEnd
(
2
000
),
frameBegin
(
3000
),
frameEnd
(
5
000
),
build
(
1000
,
1
000
),
build
(
3000
,
2
000
),
]).
countFrames
(),
2
,
);
...
...
@@ -78,32 +73,12 @@ void main() {
test
(
'computes average frame build time in milliseconds'
,
()
{
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameBegin
(
1000
),
frameEnd
(
2
000
),
frameBegin
(
3000
),
frameEnd
(
5
000
),
build
(
1000
,
1
000
),
build
(
3000
,
2
000
),
]).
computeAverageFrameBuildTimeMillis
(),
1.5
,
);
});
test
(
'skips leading "end" events'
,
()
{
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameEnd
(
1000
),
frameBegin
(
2000
),
frameEnd
(
4000
),
]).
computeAverageFrameBuildTimeMillis
(),
2.0
,
);
});
test
(
'skips trailing "begin" events'
,
()
{
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameBegin
(
2000
),
frameEnd
(
4000
),
frameBegin
(
5000
),
]).
computeAverageFrameBuildTimeMillis
(),
2.0
,
);
});
});
group
(
'worst_frame_build_time_millis'
,
()
{
...
...
@@ -117,35 +92,15 @@ void main() {
test
(
'computes worst frame build time in milliseconds'
,
()
{
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameBegin
(
1000
),
frameEnd
(
2000
),
frameBegin
(
3000
),
frameEnd
(
5000
),
]).
computeWorstFrameBuildTimeMillis
(),
2.0
,
);
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameBegin
(
3000
),
frameEnd
(
5000
),
frameBegin
(
1000
),
frameEnd
(
2000
),
build
(
1000
,
1000
),
build
(
3000
,
2000
),
]).
computeWorstFrameBuildTimeMillis
(),
2.0
,
);
});
test
(
'skips leading "end" events'
,
()
{
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameEnd
(
1000
),
frameBegin
(
2000
),
frameEnd
(
4000
),
]).
computeWorstFrameBuildTimeMillis
(),
2.0
,
);
});
test
(
'skips trailing "begin" events'
,
()
{
expect
(
summarize
(<
Map
<
String
,
dynamic
>>[
frameBegin
(
2000
),
frameEnd
(
4
000
),
frameBegin
(
5
000
),
build
(
3000
,
2
000
),
build
(
1000
,
1
000
),
]).
computeWorstFrameBuildTimeMillis
(),
2.0
,
);
...
...
@@ -155,9 +110,9 @@ void main() {
group
(
'computeMissedFrameBuildBudgetCount'
,
()
{
test
(
'computes the number of missed build budgets'
,
()
{
final
TimelineSummary
summary
=
summarize
(<
Map
<
String
,
dynamic
>>[
frameBegin
(
1000
),
frameEnd
(
18
000
),
frameBegin
(
19000
),
frameEnd
(
28
000
),
frameBegin
(
29000
),
frameEnd
(
47
000
),
build
(
1000
,
17
000
),
build
(
19000
,
9
000
),
build
(
29000
,
18
000
),
]);
expect
(
summary
.
countFrames
(),
3
);
...
...
@@ -312,9 +267,9 @@ void main() {
begin
(
1000
),
end
(
19000
),
begin
(
19000
),
end
(
29000
),
begin
(
29000
),
end
(
49000
),
frameBegin
(
1000
),
frameEnd
(
18
000
),
frameBegin
(
19000
),
frameEnd
(
28
000
),
frameBegin
(
29000
),
frameEnd
(
48
000
),
build
(
1000
,
17
000
),
build
(
19000
,
9
000
),
build
(
29000
,
19
000
),
]).
summaryJson
,
<
String
,
dynamic
>{
'average_frame_build_time_millis'
:
15.0
,
...
...
@@ -362,9 +317,9 @@ void main() {
begin
(
1000
),
end
(
19000
),
begin
(
19000
),
end
(
29000
),
begin
(
29000
),
end
(
49000
),
frameBegin
(
1000
),
frameEnd
(
18
000
),
frameBegin
(
19000
),
frameEnd
(
28
000
),
frameBegin
(
29000
),
frameEnd
(
48
000
),
build
(
1000
,
17
000
),
build
(
19000
,
9
000
),
build
(
29000
,
19
000
),
]).
writeSummaryToFile
(
'test'
,
destinationDirectory:
tempDir
.
path
);
final
String
written
=
await
fs
.
file
(
path
.
join
(
tempDir
.
path
,
'test.timeline_summary.json'
)).
readAsString
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment