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
2c716c4d
Unverified
Commit
2c716c4d
authored
Aug 17, 2020
by
Ming Lyu (CareF)
Committed by
GitHub
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vsync overhead to `FrameTimingSummarizer` (#63835)
parent
8f3805f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
5 deletions
+47
-5
frame_timing_summarizer.dart
packages/flutter_test/lib/src/frame_timing_summarizer.dart
+32
-1
frame_timing_summarizer_test.dart
packages/flutter_test/test/frame_timing_summarizer_test.dart
+15
-4
No files found.
packages/flutter_test/lib/src/frame_timing_summarizer.dart
View file @
2c716c4d
...
...
@@ -31,12 +31,18 @@ class FrameTimingSummarizer {
);
final
List
<
Duration
>
frameRasterizerTimeSorted
=
List
<
Duration
>.
from
(
frameRasterizerTime
)..
sort
();
final
List
<
Duration
>
vsyncOverhead
=
List
<
Duration
>.
unmodifiable
(
data
.
map
<
Duration
>((
FrameTiming
datum
)
=>
datum
.
vsyncOverhead
),
);
final
List
<
Duration
>
vsyncOverheadSorted
=
List
<
Duration
>.
from
(
vsyncOverhead
)..
sort
();
final
Duration
Function
(
Duration
,
Duration
)
add
=
(
Duration
a
,
Duration
b
)
=>
a
+
b
;
return
FrameTimingSummarizer
.
_
(
frameBuildTime:
frameBuildTime
,
frameRasterizerTime:
frameRasterizerTime
,
// This avarage calculation is microsecond precision, which is fine
vsyncOverhead:
vsyncOverhead
,
// This average calculation is microsecond precision, which is fine
// because typical values of these times are milliseconds.
averageFrameBuildTime:
frameBuildTime
.
reduce
(
add
)
~/
data
.
length
,
p90FrameBuildTime:
_findPercentile
(
frameBuildTimeSorted
,
0.90
),
...
...
@@ -50,6 +56,10 @@ class FrameTimingSummarizer {
worstFrameRasterizerTime:
frameRasterizerTimeSorted
.
last
,
missedFrameRasterizerBudget:
_countExceed
(
frameRasterizerTimeSorted
,
kBuildBudget
),
averageVsyncOverhead:
vsyncOverhead
.
reduce
(
add
)
~/
data
.
length
,
p90VsyncOverhead:
_findPercentile
(
vsyncOverheadSorted
,
0.90
),
p99VsyncOverhead:
_findPercentile
(
vsyncOverheadSorted
,
0.99
),
worstVsyncOverhead:
vsyncOverheadSorted
.
last
,
);
}
...
...
@@ -66,6 +76,11 @@ class FrameTimingSummarizer {
@required
this
.
p99FrameRasterizerTime
,
@required
this
.
worstFrameRasterizerTime
,
@required
this
.
missedFrameRasterizerBudget
,
@required
this
.
vsyncOverhead
,
@required
this
.
averageVsyncOverhead
,
@required
this
.
p90VsyncOverhead
,
@required
this
.
p99VsyncOverhead
,
@required
this
.
worstVsyncOverhead
,
});
/// List of frame build time in microseconds
...
...
@@ -74,6 +89,10 @@ class FrameTimingSummarizer {
/// List of frame rasterizer time in microseconds
final
List
<
Duration
>
frameRasterizerTime
;
/// List of the time difference between vsync signal and frame building start
/// time
final
List
<
Duration
>
vsyncOverhead
;
/// The average value of [frameBuildTime] in milliseconds.
final
Duration
averageFrameBuildTime
;
...
...
@@ -104,6 +123,18 @@ class FrameTimingSummarizer {
/// Number of items in [frameRasterizerTime] that's greater than [kBuildBudget]
final
int
missedFrameRasterizerBudget
;
/// The average value of [vsyncOverhead];
final
Duration
averageVsyncOverhead
;
/// The 90-th percentile value of [vsyncOverhead] in milliseconds
final
Duration
p90VsyncOverhead
;
/// The 99-th percentile value of [vsyncOverhead] in milliseconds
final
Duration
p99VsyncOverhead
;
/// The largest value of [vsyncOverhead] in milliseconds.
final
Duration
worstVsyncOverhead
;
/// Convert the summary result to a json object.
///
/// See [TimelineSummary.summaryJson] for detail.
...
...
packages/flutter_test/test/frame_timing_summarizer_test.dart
View file @
2c716c4d
...
...
@@ -8,24 +8,30 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
test
(
'Test FrameTimingSummarizer'
,
()
{
List
<
int
>
vsyncTimes
=
<
int
>[
for
(
int
i
=
0
;
i
<
100
;
i
+=
1
)
100
*
(
i
+
1
),
];
List
<
int
>
buildTimes
=
<
int
>[
for
(
int
i
=
1
;
i
<=
100
;
i
+=
1
)
1000
*
i
,
for
(
int
i
=
0
;
i
<
100
;
i
+=
1
)
vsyncTimes
[
i
]
+
1000
*
(
i
+
1
)
,
];
buildTimes
=
buildTimes
.
reversed
.
toList
();
List
<
int
>
rasterTimes
=
<
int
>[
for
(
int
i
=
1
;
i
<=
100
;
i
+=
1
)
1000
*
i
+
1000
,
for
(
int
i
=
0
;
i
<
100
;
i
+=
1
)
1000
*
(
i
+
1
)
+
1000
,
];
// reversed to make sure sort is working.
buildTimes
=
buildTimes
.
reversed
.
toList
();
rasterTimes
=
rasterTimes
.
reversed
.
toList
();
vsyncTimes
=
vsyncTimes
.
reversed
.
toList
();
final
List
<
FrameTiming
>
inputData
=
<
FrameTiming
>[
for
(
int
i
=
0
;
i
<
100
;
i
+=
1
)
FrameTiming
(
vsyncStart:
0
,
buildStart:
0
,
buildStart:
vsyncTimes
[
i
]
,
buildFinish:
buildTimes
[
i
],
rasterStart:
500
,
rasterFinish:
rasterTimes
[
i
],
),
];
final
FrameTimingSummarizer
summary
=
FrameTimingSummarizer
(
inputData
);
expect
(
summary
.
averageFrameBuildTime
.
inMicroseconds
,
50500
);
expect
(
summary
.
p90FrameBuildTime
.
inMicroseconds
,
90000
);
...
...
@@ -39,5 +45,10 @@ void main() {
expect
(
summary
.
worstFrameRasterizerTime
.
inMicroseconds
,
100500
);
expect
(
summary
.
missedFrameRasterizerBudget
,
85
);
expect
(
summary
.
frameBuildTime
.
length
,
100
);
expect
(
summary
.
averageVsyncOverhead
.
inMicroseconds
,
5050
);
expect
(
summary
.
p90VsyncOverhead
.
inMicroseconds
,
9000
);
expect
(
summary
.
p99VsyncOverhead
.
inMicroseconds
,
9900
);
expect
(
summary
.
worstVsyncOverhead
.
inMicroseconds
,
10000
);
});
}
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