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
c81449e5
Unverified
Commit
c81449e5
authored
May 14, 2020
by
Yegor
Committed by
GitHub
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Recorder override shouldContinue (#57039)
parent
573625b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
12 deletions
+33
-12
recorder.dart
dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart
+33
-12
No files found.
dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart
View file @
c81449e5
...
...
@@ -111,6 +111,17 @@ abstract class Recorder {
/// prefix.
final
String
name
;
/// Returns the recorded profile.
///
/// This value is only available while the benchmark is running.
Profile
get
profile
;
/// Whether the benchmark should continue running.
///
/// Returns `false` if the benchmark collected enough data and it's time to
/// stop.
bool
shouldContinue
()
=>
profile
.
shouldContinue
();
/// Called once before all runs of this benchmark recorder.
///
/// This is useful for doing one-time setup work that's needed for the
...
...
@@ -158,15 +169,19 @@ abstract class RawRecorder extends Recorder {
/// This is the part that records measurements of the benchmark.
void
body
(
Profile
profile
);
@override
Profile
get
profile
=>
_profile
;
Profile
_profile
;
@override
@nonVirtual
Future
<
Profile
>
run
()
async
{
final
Profile
profile
=
Profile
(
name:
name
);
_
profile
=
Profile
(
name:
name
);
do
{
await
Future
<
void
>.
delayed
(
Duration
.
zero
);
body
(
profile
);
}
while
(
profile
.
shouldContinue
());
return
profile
;
body
(
_
profile
);
}
while
(
shouldContinue
());
return
_
profile
;
}
}
...
...
@@ -198,6 +213,10 @@ abstract class RawRecorder extends Recorder {
abstract
class
SceneBuilderRecorder
extends
Recorder
{
SceneBuilderRecorder
({
@required
String
name
})
:
super
.
_
(
name
,
true
);
@override
Profile
get
profile
=>
_profile
;
Profile
_profile
;
/// Called from [Window.onBeginFrame].
@mustCallSuper
void
onBeginFrame
()
{}
...
...
@@ -212,7 +231,7 @@ abstract class SceneBuilderRecorder extends Recorder {
@override
Future
<
Profile
>
run
()
{
final
Completer
<
Profile
>
profileCompleter
=
Completer
<
Profile
>();
final
Profile
profile
=
Profile
(
name:
name
);
_
profile
=
Profile
(
name:
name
);
window
.
onBeginFrame
=
(
_
)
{
try
{
...
...
@@ -225,22 +244,22 @@ abstract class SceneBuilderRecorder extends Recorder {
};
window
.
onDrawFrame
=
()
{
try
{
profile
.
record
(
'drawFrameDuration'
,
()
{
_
profile
.
record
(
'drawFrameDuration'
,
()
{
final
SceneBuilder
sceneBuilder
=
SceneBuilder
();
onDrawFrame
(
sceneBuilder
);
profile
.
record
(
'sceneBuildDuration'
,
()
{
_
profile
.
record
(
'sceneBuildDuration'
,
()
{
final
Scene
scene
=
sceneBuilder
.
build
();
profile
.
record
(
'windowRenderDuration'
,
()
{
_
profile
.
record
(
'windowRenderDuration'
,
()
{
window
.
render
(
scene
);
},
reported:
false
);
},
reported:
false
);
},
reported:
true
);
endMeasureFrame
();
if
(
profile
.
shouldContinue
())
{
if
(
shouldContinue
())
{
window
.
scheduleFrame
();
}
else
{
profileCompleter
.
complete
(
profile
);
profileCompleter
.
complete
(
_
profile
);
}
}
catch
(
error
,
stackTrace
)
{
profileCompleter
.
completeError
(
error
,
stackTrace
);
...
...
@@ -326,6 +345,7 @@ abstract class WidgetRecorder extends Recorder implements FrameRecorder {
@override
VoidCallback
didStop
;
@override
Profile
profile
;
Completer
<
void
>
_runCompleter
;
...
...
@@ -344,7 +364,7 @@ abstract class WidgetRecorder extends Recorder implements FrameRecorder {
endMeasureFrame
();
profile
.
addDataPoint
(
'drawFrameDuration'
,
_drawFrameStopwatch
.
elapsed
,
reported:
true
);
if
(
profile
.
shouldContinue
())
{
if
(
shouldContinue
())
{
window
.
scheduleFrame
();
}
else
{
didStop
();
...
...
@@ -414,6 +434,7 @@ abstract class WidgetBuildRecorder extends Recorder implements FrameRecorder {
@override
VoidCallback
didStop
;
@override
Profile
profile
;
Completer
<
void
>
_runCompleter
;
...
...
@@ -453,7 +474,7 @@ abstract class WidgetBuildRecorder extends Recorder implements FrameRecorder {
profile
.
addDataPoint
(
'drawFrameDuration'
,
_drawFrameStopwatch
.
elapsed
,
reported:
true
);
}
if
(
profile
.
shouldContinue
())
{
if
(
shouldContinue
())
{
showWidget
=
!
showWidget
;
_hostState
.
_setStateTrampoline
();
}
else
{
...
...
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