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
718a88d0
Commit
718a88d0
authored
Sep 12, 2016
by
John McCutchan
Committed by
GitHub
Sep 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a --benchmark mode to hot run (#5787)
parent
f5c98f62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-0
hot.dart
packages/flutter_tools/lib/src/hot.dart
+31
-1
No files found.
packages/flutter_tools/lib/src/commands/run.dart
View file @
718a88d0
...
...
@@ -169,6 +169,7 @@ class RunCommand extends RunCommandBase {
deviceForCommand
,
target:
targetFile
,
debuggingOptions:
options
,
benchmarkMode:
argResults
[
'benchmark'
],
);
}
else
{
runner
=
new
RunAndStayResident
(
...
...
packages/flutter_tools/lib/src/hot.dart
View file @
718a88d0
...
...
@@ -119,7 +119,8 @@ class HotRunner extends ResidentRunner {
Device
device
,
{
String
target
,
DebuggingOptions
debuggingOptions
,
bool
usesTerminalUI:
true
bool
usesTerminalUI:
true
,
this
.
benchmarkMode
:
false
,
})
:
super
(
device
,
target:
target
,
debuggingOptions:
debuggingOptions
,
...
...
@@ -132,6 +133,8 @@ class HotRunner extends ResidentRunner {
String
_projectRootPath
;
Set
<
String
>
_startupDependencies
;
final
AssetBundle
bundle
=
new
AssetBundle
();
final
bool
benchmarkMode
;
final
Map
<
String
,
int
>
benchmarkData
=
new
Map
<
String
,
int
>();
@override
Future
<
int
>
run
({
...
...
@@ -283,6 +286,25 @@ class HotRunner extends ResidentRunner {
// Finish the file sync now.
await
_updateDevFS
();
if
(
benchmarkMode
)
{
// We are running in benchmark mode.
printStatus
(
'Running in benchmark mode.'
);
// Measure time to perform a hot restart.
printStatus
(
'Benchmarking hot restart'
);
await
restart
(
fullRestart:
true
);
await
vmService
.
vm
.
refreshViews
();
// TODO(johnmccutchan): Modify script entry point.
printStatus
(
'Benchmarking hot reload'
);
// Measure time to perform a hot reload.
await
restart
(
fullRestart:
false
);
printStatus
(
'Benchmark completed. Exiting application.'
);
await
_cleanupDevFS
();
await
stopEchoingDeviceLog
();
await
stopApp
();
File
benchmarkOutput
=
new
File
(
'hot_benchmark.json'
);
benchmarkOutput
.
writeAsStringSync
(
toPrettyJson
(
benchmarkData
));
}
return
waitForAppToFinish
();
}
...
...
@@ -399,6 +421,10 @@ class HotRunner extends ResidentRunner {
restartStatus
.
stop
(
showElapsedTime:
true
);
printStatus
(
'Restart time: '
'
${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}
'
);
if
(
benchmarkMode
)
{
benchmarkData
[
'hotRestartMillisecondsToFrame'
]
=
firstFrameTimer
.
elapsed
.
inMilliseconds
;
}
flutterUsage
.
sendEvent
(
'hot'
,
'restart'
);
flutterUsage
.
sendTiming
(
'hot'
,
'restart'
,
firstFrameTimer
.
elapsed
);
}
...
...
@@ -474,6 +500,10 @@ class HotRunner extends ResidentRunner {
await
firstFrameTimer
.
firstFrame
();
printStatus
(
'Hot reload time: '
'
${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}
'
);
if
(
benchmarkMode
)
{
benchmarkData
[
'hotReloadMillisecondsToFrame'
]
=
firstFrameTimer
.
elapsed
.
inMilliseconds
;
}
flutterUsage
.
sendTiming
(
'hot'
,
'reload'
,
firstFrameTimer
.
elapsed
);
return
true
;
}
...
...
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