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
2563636d
Commit
2563636d
authored
Dec 02, 2016
by
Jason Simmons
Committed by
GitHub
Dec 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A devicelab test of memory usage for a minimal app (#7126)
parent
45a4f639
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
30 deletions
+50
-30
hello_world__memory.dart
dev/devicelab/bin/tasks/hello_world__memory.dart
+12
-0
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+38
-30
No files found.
dev/devicelab/bin/tasks/hello_world__memory.dart
0 → 100644
View file @
2563636d
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter_devicelab/tasks/perf_tests.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
Future
<
Null
>
main
()
async
{
await
task
(
createHelloWorldMemoryTest
());
}
dev/devicelab/lib/tasks/perf_tests.dart
View file @
2563636d
...
...
@@ -20,9 +20,8 @@ TaskFunction createComplexLayoutScrollPerfTest() {
TaskFunction
createComplexLayoutScrollMemoryTest
(
)
{
return
new
MemoryTest
(
'
${flutterDirectory.path}
/dev/benchmarks/complex_layout'
,
'test_driver/scroll_perf.dart'
,
'complex_layout_scroll_perf'
,
'com.yourcompany.complexLayout'
,
testTarget:
'test_driver/scroll_perf.dart'
,
);
}
...
...
@@ -46,6 +45,13 @@ TaskFunction createComplexLayoutBuildTest() {
return
new
BuildTest
(
'
${flutterDirectory.path}
/dev/benchmarks/complex_layout'
);
}
TaskFunction
createHelloWorldMemoryTest
(
)
{
return
new
MemoryTest
(
'
${flutterDirectory.path}
/examples/hello_world'
,
'io.flutter.examples.HelloWorld'
,
);
}
/// Measure application startup performance.
class
StartupTest
{
static
const
Duration
_startupTimeout
=
const
Duration
(
minutes:
2
);
...
...
@@ -174,14 +180,18 @@ class BuildTest {
}
}
/// Measure application memory usage.
class
MemoryTest
{
MemoryTest
(
this
.
testDirectory
,
this
.
testTarget
,
this
.
timelineFileName
,
this
.
packageName
);
MemoryTest
(
this
.
testDirectory
,
this
.
packageName
,
{
this
.
testTarget
}
);
final
String
testDirectory
;
final
String
testTarget
;
final
String
timelineFileName
;
final
String
packageName
;
/// Path to a flutter driver script that will run after starting the app.
///
/// If not specified, then the test will start the app, gather statistics, and then exit.
final
String
testTarget
;
Future
<
TaskResult
>
call
()
{
return
inDirectory
(
testDirectory
,
()
async
{
Device
device
=
await
devices
.
workingDevice
;
...
...
@@ -196,47 +206,45 @@ class MemoryTest {
int
debugPort
=
await
findAvailablePort
();
await
flutter
(
'run'
,
options:
<
String
>[
List
<
String
>
runOptions
=
<
String
>[
'-v'
,
'--profile'
,
'--trace-startup'
,
// wait for the first frame to render
'-t'
,
testTarget
,
'-d'
,
deviceId
,
'--debug-port'
,
debugPort
.
toString
(),
]);
];
if
(
testTarget
!=
null
)
runOptions
.
addAll
(<
String
>[
'-t'
,
testTarget
]);
await
flutter
(
'run'
,
options:
runOptions
);
Map
<
String
,
dynamic
>
startData
=
await
device
.
getMemoryStats
(
packageName
);
await
flutter
(
'drive'
,
options:
<
String
>[
'-v'
,
'-t'
,
testTarget
,
'-d'
,
deviceId
,
'--use-existing-app'
,
//'--keep-app-running',
],
env:
<
String
,
String
>
{
'VM_SERVICE_URL'
:
'http://localhost:
$debugPort
'
});
Map
<
String
,
dynamic
>
endData
=
await
device
.
getMemoryStats
(
packageName
);
Map
<
String
,
dynamic
>
data
=
<
String
,
dynamic
>{
'start_total_kb'
:
startData
[
'total_kb'
],
'end_total_kb'
:
endData
[
'total_kb'
],
'diff_total_kb'
:
endData
[
'total_kb'
]
-
startData
[
'total_kb'
],
};
if
(
testTarget
!=
null
)
{
await
flutter
(
'drive'
,
options:
<
String
>[
'-v'
,
'-t'
,
testTarget
,
'-d'
,
deviceId
,
'--use-existing-app'
,
],
env:
<
String
,
String
>
{
'VM_SERVICE_URL'
:
'http://localhost:
$debugPort
'
});
Map
<
String
,
dynamic
>
endData
=
await
device
.
getMemoryStats
(
packageName
);
data
[
'end_total_kb'
]
=
endData
[
'total_kb'
];
data
[
'diff_total_kb'
]
=
endData
[
'total_kb'
]
-
startData
[
'total_kb'
];
}
await
device
.
stop
(
packageName
);
return
new
TaskResult
.
success
(
data
,
benchmarkScoreKeys:
<
String
>[
'start_total_kb'
,
'end_total_kb'
,
'diff_total_kb'
,
]);
return
new
TaskResult
.
success
(
data
,
benchmarkScoreKeys:
data
.
keys
.
toList
());
});
}
}
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