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
2fd786b5
Commit
2fd786b5
authored
Dec 06, 2016
by
Jason Simmons
Committed by
GitHub
Dec 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A devicelab memory test for Android app suspend and resume (#7164)
parent
7536404b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
0 deletions
+77
-0
flutter_gallery__back_button_memory.dart
...icelab/bin/tasks/flutter_gallery__back_button_memory.dart
+12
-0
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+59
-0
manifest.yaml
dev/devicelab/manifest.yaml
+6
-0
No files found.
dev/devicelab/bin/tasks/flutter_gallery__back_button_memory.dart
0 → 100644
View file @
2fd786b5
// 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
(
createGalleryBackButtonMemoryTest
());
}
dev/devicelab/lib/tasks/perf_tests.dart
View file @
2fd786b5
...
...
@@ -60,6 +60,13 @@ TaskFunction createGalleryNavigationMemoryTest() {
);
}
TaskFunction
createGalleryBackButtonMemoryTest
(
)
{
return
new
AndroidBackButtonMemoryTest
(
'
${flutterDirectory.path}
/examples/flutter_gallery'
,
'io.flutter.examples.gallery'
,
);
}
/// Measure application startup performance.
class
StartupTest
{
static
const
Duration
_startupTimeout
=
const
Duration
(
minutes:
2
);
...
...
@@ -256,3 +263,55 @@ class MemoryTest {
});
}
}
/// Measure application memory usage after pausing and resuming the app
/// with the Android back button.
class
AndroidBackButtonMemoryTest
{
final
String
testDirectory
;
final
String
packageName
;
AndroidBackButtonMemoryTest
(
this
.
testDirectory
,
this
.
packageName
);
Future
<
TaskResult
>
call
()
{
return
inDirectory
(
testDirectory
,
()
async
{
if
(
deviceOperatingSystem
!=
DeviceOperatingSystem
.
android
)
{
throw
'This test is only supported on Android'
;
}
AndroidDevice
device
=
await
devices
.
workingDevice
;
await
device
.
unlock
();
String
deviceId
=
device
.
deviceId
;
await
flutter
(
'packages'
,
options:
<
String
>[
'get'
]);
await
flutter
(
'run'
,
options:
<
String
>[
'-v'
,
'--profile'
,
'--trace-startup'
,
// wait for the first frame to render
'-d'
,
deviceId
,
]);
Map
<
String
,
dynamic
>
startData
=
await
device
.
getMemoryStats
(
packageName
);
Map
<
String
,
dynamic
>
data
=
<
String
,
dynamic
>{
'start_total_kb'
:
startData
[
'total_kb'
],
};
// Perform a series of back button suspend and resume cycles.
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
device
.
shellExec
(
'input'
,
<
String
>[
'keyevent'
,
'KEYCODE_BACK'
]);
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
1000
));
device
.
shellExec
(
'am'
,
<
String
>[
'start'
,
'-n'
,
'io.flutter.examples.gallery/org.domokit.sky.shell.SkyActivity'
]);
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
1000
));
}
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:
data
.
keys
.
toList
());
});
}
}
dev/devicelab/manifest.yaml
View file @
2fd786b5
...
...
@@ -127,6 +127,12 @@ tasks:
stage
:
devicelab
required_agent_capabilities
:
[
"
has-android-device"
]
flutter_gallery__back_button_memory
:
description
:
>
Measures memory usage after Android app suspend and resume.
stage
:
devicelab
required_agent_capabilities
:
[
"
has-android-device"
]
# iOS on-device tests
...
...
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