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
a6357651
Unverified
Commit
a6357651
authored
4 years ago
by
liyuqian
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland "Add DevTools memory test (#55486)" (#57340)
parent
82eeb940
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
1 deletion
+151
-1
complex_layout_scroll_perf__devtools_memory.dart
...in/tasks/complex_layout_scroll_perf__devtools_memory.dart
+18
-0
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+126
-1
manifest.yaml
dev/devicelab/manifest.yaml
+7
-0
No files found.
dev/devicelab/bin/tasks/complex_layout_scroll_perf__devtools_memory.dart
0 → 100644
View file @
a6357651
// Copyright 2014 The Flutter 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/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:flutter_devicelab/tasks/perf_tests.dart'
;
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
await
task
(
DevToolsMemoryTest
(
'
${flutterDirectory.path}
/dev/benchmarks/complex_layout'
,
'test_driver/scroll_perf.dart'
,
).
run
);
}
This diff is collapsed.
Click to expand it.
dev/devicelab/lib/tasks/perf_tests.dart
View file @
a6357651
...
...
@@ -3,8 +3,9 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:convert'
show
json
;
import
'dart:convert'
show
LineSplitter
,
json
,
utf8
;
import
'dart:io'
;
import
'dart:math'
as
math
;
import
'package:meta/meta.dart'
;
import
'package:path/path.dart'
as
path
;
...
...
@@ -692,6 +693,130 @@ class MemoryTest {
}
}
class
DevToolsMemoryTest
{
DevToolsMemoryTest
(
this
.
project
,
this
.
driverTest
);
final
String
project
;
final
String
driverTest
;
Future
<
TaskResult
>
run
()
{
return
inDirectory
<
TaskResult
>(
project
,
()
async
{
_device
=
await
devices
.
workingDevice
;
await
_device
.
unlock
();
await
flutter
(
'packages'
,
options:
<
String
>[
'get'
]);
await
_launchApp
();
if
(
_observatoryUri
==
null
)
{
return
TaskResult
.
failure
(
'Observatory URI not found.'
);
}
await
_launchDevTools
();
await
flutter
(
'drive'
,
options:
<
String
>[
'--use-existing-app'
,
_observatoryUri
,
'-d'
,
_device
.
deviceId
,
'--profile'
,
driverTest
,
],
);
_devToolsProcess
.
kill
();
await
_devToolsProcess
.
exitCode
;
_runProcess
.
kill
();
await
_runProcess
.
exitCode
;
final
Map
<
String
,
dynamic
>
data
=
json
.
decode
(
file
(
'
$project
/
$_kJsonFileName
'
).
readAsStringSync
(),
)
as
Map
<
String
,
dynamic
>;
final
List
<
dynamic
>
samples
=
data
[
'samples'
][
'data'
]
as
List
<
dynamic
>;
int
maxRss
=
0
;
int
maxAdbTotal
=
0
;
for
(
final
dynamic
sample
in
samples
)
{
maxRss
=
math
.
max
(
maxRss
,
sample
[
'rss'
]
as
int
);
if
(
sample
[
'adb_memoryInfo'
]
!=
null
)
{
maxAdbTotal
=
math
.
max
(
maxAdbTotal
,
sample
[
'adb_memoryInfo'
][
'Total'
]
as
int
);
}
}
return
TaskResult
.
success
(
<
String
,
dynamic
>{
'maxRss'
:
maxRss
,
'maxAdbTotal'
:
maxAdbTotal
},
benchmarkScoreKeys:
<
String
>[
'maxRss'
,
'maxAdbTotal'
],
);
});
}
Future
<
void
>
_launchApp
()
async
{
print
(
'launching
$project$driverTest
on device...'
);
final
String
flutterPath
=
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
);
_runProcess
=
await
startProcess
(
flutterPath
,
<
String
>[
'run'
,
'--verbose'
,
'--profile'
,
'-d'
,
_device
.
deviceId
,
driverTest
,
],
);
// Listen for Observatory URI and forward stdout/stderr
final
Completer
<
String
>
observatoryUri
=
Completer
<
String
>();
_runProcess
.
stdout
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
print
(
'run stdout:
$line
'
);
final
RegExpMatch
match
=
RegExp
(
r'An Observatory debugger and profiler on .+ is available at: ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)'
).
firstMatch
(
line
);
if
(
match
!=
null
)
{
observatoryUri
.
complete
(
match
[
1
]);
_observatoryUri
=
match
[
1
];
}
},
onDone:
()
{
observatoryUri
.
complete
(
null
);
});
_forwardStream
(
_runProcess
.
stderr
,
'run stderr'
);
_observatoryUri
=
await
observatoryUri
.
future
;
}
Future
<
void
>
_launchDevTools
()
async
{
await
exec
(
'pub'
,
<
String
>[
'global'
,
'activate'
,
'devtools'
,
'0.2.5'
,
]);
_devToolsProcess
=
await
startProcess
(
'pub'
,
<
String
>[
'global'
,
'run'
,
'devtools'
,
'--vm-uri'
,
_observatoryUri
,
'--profile-memory'
,
_kJsonFileName
,
],
);
_forwardStream
(
_devToolsProcess
.
stdout
,
'devtools stdout'
);
_forwardStream
(
_devToolsProcess
.
stderr
,
'devtools stderr'
);
}
void
_forwardStream
(
Stream
<
List
<
int
>>
stream
,
String
label
)
{
stream
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
print
(
'
$label
:
$line
'
);
});
}
Device
_device
;
String
_observatoryUri
;
Process
_runProcess
;
Process
_devToolsProcess
;
static
const
String
_kJsonFileName
=
'devtools_memory.json'
;
}
enum
ReportedDurationTestFlavor
{
debug
,
profile
,
release
}
...
...
This diff is collapsed.
Click to expand it.
dev/devicelab/manifest.yaml
View file @
a6357651
...
...
@@ -285,6 +285,13 @@ tasks:
stage
:
devicelab
required_agent_capabilities
:
[
"
mac/android"
]
complex_layout_scroll_perf__devtools_memory
:
description
:
>
Measures memory usage of the scroll performance test using DevTools.
stage
:
devicelab
required_agent_capabilities
:
[
"
linux/android"
]
flaky
:
true
hello_world_android__compile
:
description
:
>
Measures the APK size of Hello World.
...
...
This diff is collapsed.
Click to expand it.
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