Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions agent/lib/src/adb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ Future<Adb> realAdbGetter() async {
return _currentDevice;
}

/// Gets the ID of an unlocked device, unlocking it if necessary.
// TODO(yjbanov): abstract away iOS from Android.
Future<String> getUnlockedDeviceId({ bool ios: false }) async {
if (ios) {
// We currently do not have a way to lock/unlock iOS devices, or even to
// pick one out of many. So we pick the first random iPhone and assume it's
// already unlocked. For now we'll just keep them at minimum screen
// brightness so they don't drain battery too fast.
List<String> iosDeviceIds = grep('UniqueDeviceID', from: await eval('ideviceinfo', []))
.map((String line) => line.split(' ').last).toList();

if (iosDeviceIds.isEmpty)
throw 'No connected iOS devices found.';

return iosDeviceIds.first;
}

Adb device = await adb();
device.unlock();
return device.deviceId;
}

class Adb {
Adb({String this.deviceId});

Expand Down
4 changes: 4 additions & 0 deletions agent/lib/src/agent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ class Agent {

List<Task> allTasks = <Task>[
createComplexLayoutScrollPerfTest(),
createComplexLayoutScrollPerfTest(ios: true),
createFlutterGalleryStartupTest(),
createFlutterGalleryStartupTest(ios: true),
createComplexLayoutStartupTest(),
createComplexLayoutStartupTest(ios: true),
createFlutterGalleryBuildTest(),
createComplexLayoutBuildTest(),
createGalleryTransitionTest(),
createGalleryTransitionTest(ios: true),
createBasicMaterialAppSizeTest(),
createAnalyzerCliTest(sdk: dartSdkVersion, commit: task.revision, timestamp: revisionTimestamp),
createAnalyzerServerTest(sdk: dartSdkVersion, commit: task.revision, timestamp: revisionTimestamp),
Expand Down
2 changes: 1 addition & 1 deletion agent/lib/src/commands/run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class RunCommand extends Command {
try {
await runAndCaptureAsyncStacks(() async {
// Load-balance tests across attached devices
pickNextDevice();
await pickNextDevice();

BuildResult result = await agent.performTask(task);
if (task.key != null) {
Expand Down
17 changes: 12 additions & 5 deletions agent/lib/src/gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,32 @@ import 'adb.dart';
import 'framework.dart';
import 'utils.dart';

Task createGalleryTransitionTest() => new GalleryTransitionTest();
Task createGalleryTransitionTest({ bool ios: false }) => new GalleryTransitionTest(ios: ios);

class GalleryTransitionTest extends Task {
GalleryTransitionTest() : super('flutter_gallery__transition_perf');
GalleryTransitionTest({ this.ios }) : super('flutter_gallery__transition_perf');

final bool ios;

@override
Future<TaskResultData> run() async {
Adb device = await adb();
device.unlock();
String deviceId = await getUnlockedDeviceId(ios: ios);
Directory galleryDirectory = dir('${config.flutterDirectory.path}/examples/flutter_gallery');
await inDirectory(galleryDirectory, () async {
await pub('get');

if (ios) {
// This causes an Xcode project to be created.
await flutter('build', options: ['ios', '--profile']);
}

await flutter('drive', options: [
'--profile',
'--trace-startup',
'-t',
'test_driver/transitions_perf.dart',
'-d',
device.deviceId,
deviceId,
]);
});

Expand Down
53 changes: 37 additions & 16 deletions agent/lib/src/perf_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,30 @@ import 'adb.dart';
import 'framework.dart';
import 'utils.dart';

Task createComplexLayoutScrollPerfTest() {
Task createComplexLayoutScrollPerfTest({ bool ios: false }) {
return new PerfTest(
'complex_layout_scroll_perf__timeline_summary',
'complex_layout_scroll_perf${ios ? "_ios" : ""}__timeline_summary',
'${config.flutterDirectory.path}/dev/benchmarks/complex_layout',
'test_driver/scroll_perf.dart',
'complex_layout_scroll_perf'
'complex_layout_scroll_perf',
ios: ios
);
}

Task createFlutterGalleryStartupTest() {
return new StartupTest('flutter_gallery__start_up', '${config.flutterDirectory.path}/examples/flutter_gallery');
Task createFlutterGalleryStartupTest({ bool ios: false }) {
return new StartupTest(
'flutter_gallery${ios ? "_ios" : ""}__start_up',
'${config.flutterDirectory.path}/examples/flutter_gallery',
ios: ios
);
}

Task createComplexLayoutStartupTest() {
return new StartupTest('complex_layout__start_up', '${config.flutterDirectory.path}/dev/benchmarks/complex_layout');
Task createComplexLayoutStartupTest({ bool ios: false }) {
return new StartupTest(
'complex_layout${ios ? "_ios" : ""}__start_up',
'${config.flutterDirectory.path}/dev/benchmarks/complex_layout',
ios: ios
);
}

Task createFlutterGalleryBuildTest() {
Expand All @@ -37,20 +46,26 @@ Task createComplexLayoutBuildTest() {
/// Measure application startup performance.
class StartupTest extends Task {

StartupTest(String name, this.testDirectory) : super(name);
StartupTest(String name, this.testDirectory, { this.ios }) : super(name);

final String testDirectory;
final bool ios;

Future<TaskResultData> run() async {
return await inDirectory(testDirectory, () async {
Adb device = await adb();
device.unlock();
String deviceId = await getUnlockedDeviceId(ios: ios);
await pub('get');

if (ios) {
// This causes an Xcode project to be created.
await flutter('build', options: ['ios', '--profile']);
}

await flutter('run', options: [
'--profile',
'--trace-startup',
'-d',
device.deviceId
deviceId
]);
Map<String, dynamic> data = JSON.decode(file('$testDirectory/build/start_up_info.json').readAsStringSync());
return new TaskResultData(data, benchmarkScoreKeys: <String>[
Expand All @@ -65,26 +80,33 @@ class StartupTest extends Task {
/// performance.
class PerfTest extends Task {

PerfTest(String name, this.testDirectory, this.testTarget, this.timelineFileName)
PerfTest(String name, this.testDirectory, this.testTarget, this.timelineFileName, { this.ios })
: super(name);

final String testDirectory;
final String testTarget;
final String timelineFileName;
final bool ios;

@override
Future<TaskResultData> run() {
return inDirectory(testDirectory, () async {
Adb device = await adb();
device.unlock();
String deviceId = await getUnlockedDeviceId(ios: ios);
await pub('get');

if (ios) {
// This causes an Xcode project to be created.
await flutter('build', options: ['ios', '--profile']);
}

await flutter('drive', options: [
'-v',
'--profile',
'--trace-startup', // Enables "endless" timeline event buffering.
'-t',
testTarget,
'-d',
device.deviceId
deviceId,
]);
Map<String, dynamic> data = JSON.decode(file('$testDirectory/build/${timelineFileName}.timeline_summary.json').readAsStringSync());
return new TaskResultData(data, benchmarkScoreKeys: <String>[
Expand All @@ -96,7 +118,6 @@ class PerfTest extends Task {
}
}


class BuildTest extends Task {

BuildTest(String name, this.testDirectory) : super(name);
Expand Down