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
42ccffca
Commit
42ccffca
authored
Jan 11, 2017
by
Yegor
Committed by
GitHub
Jan 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix microbenchmarks on iOS (#7429)
parent
7a10ed93
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
117 additions
and
79 deletions
+117
-79
animation_bench.dart
...enchmarks/microbenchmarks/lib/stocks/animation_bench.dart
+1
-0
build_bench.dart
dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart
+2
-0
layout_bench.dart
dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart
+2
-0
microbenchmarks.dart
dev/devicelab/bin/tasks/microbenchmarks.dart
+4
-79
microbenchmarks_ios.dart
dev/devicelab/bin/tasks/microbenchmarks_ios.dart
+15
-0
microbenchmarks.dart
dev/devicelab/lib/tasks/microbenchmarks.dart
+93
-0
No files found.
dev/benchmarks/microbenchmarks/lib/stocks/animation_bench.dart
View file @
42ccffca
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart
View file @
42ccffca
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -20,6 +21,7 @@ Future<Null> main() async {
await
benchmarkWidgets
((
WidgetTester
tester
)
async
{
stocks
.
main
();
await
tester
.
pump
();
// Start startup animation
new
Timer
(
const
Duration
(
milliseconds:
1100
),
()
{
});
// workaround for https://github.com/flutter/flutter/issues/7433
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Complete startup animation
await
tester
.
tapAt
(
new
Point
(
20.0
,
20.0
));
// Open drawer
await
tester
.
pump
();
// Start drawer animation
...
...
dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart
View file @
42ccffca
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -19,6 +20,7 @@ Future<Null> main() async {
await
benchmarkWidgets
((
WidgetTester
tester
)
async
{
stocks
.
main
();
await
tester
.
pump
();
// Start startup animation
new
Timer
(
const
Duration
(
milliseconds:
1100
),
()
{
});
// workaround for https://github.com/flutter/flutter/issues/7433
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Complete startup animation
await
tester
.
tapAt
(
new
Point
(
20.0
,
20.0
));
// Open drawer
await
tester
.
pump
();
// Start drawer animation
...
...
dev/devicelab/bin/tasks/microbenchmarks.dart
View file @
42ccffca
...
...
@@ -3,88 +3,13 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'package:flutter_devicelab/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/
framework/util
s.dart'
;
import
'package:flutter_devicelab/
tasks/microbenchmark
s.dart'
;
/// Runs benchmarks in `dev/benchmarks/microbenchmarks` in the device lab and
/// reports results to the dashboard.
/// Runs microbenchmarks on Android.
Future
<
Null
>
main
()
async
{
await
task
(()
async
{
Device
device
=
await
devices
.
workingDevice
;
await
device
.
unlock
();
Future
<
Map
<
String
,
double
>>
_runMicrobench
(
String
benchmarkPath
)
async
{
print
(
'Running
$benchmarkPath
'
);
Directory
appDir
=
dir
(
path
.
join
(
flutterDirectory
.
path
,
'dev/benchmarks/microbenchmarks'
));
Process
flutterProcess
=
await
inDirectory
(
appDir
,
()
async
{
return
await
_startFlutter
(
options:
<
String
>[
'--release'
,
'-d'
,
device
.
deviceId
,
benchmarkPath
,
],
canFail:
false
,
);
});
return
await
_readJsonResults
(
flutterProcess
);
}
Map
<
String
,
double
>
allResults
=
<
String
,
double
>{};
allResults
.
addAll
(
await
_runMicrobench
(
'lib/stocks/layout_bench.dart'
));
allResults
.
addAll
(
await
_runMicrobench
(
'lib/stocks/build_bench.dart'
));
allResults
.
addAll
(
await
_runMicrobench
(
'lib/stocks/animation_bench.dart'
));
allResults
.
addAll
(
await
_runMicrobench
(
'lib/gestures/velocity_tracker_bench.dart'
));
return
new
TaskResult
.
success
(
allResults
,
benchmarkScoreKeys:
allResults
.
keys
.
toList
());
});
}
Future
<
Process
>
_startFlutter
({
String
command
=
'run'
,
List
<
String
>
options:
const
<
String
>[],
bool
canFail:
false
,
Map
<
String
,
String
>
env
})
{
List
<
String
>
args
=
<
String
>[
'run'
]..
addAll
(
options
);
return
startProcess
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
args
,
env:
env
);
}
Future
<
Map
<
String
,
double
>>
_readJsonResults
(
Process
process
)
{
// IMPORTANT: keep these values in sync with dev/benchmarks/microbenchmarks/lib/common.dart
const
String
jsonStart
=
'================ RESULTS ================'
;
const
String
jsonEnd
=
'================ FORMATTED =============='
;
bool
jsonStarted
=
false
;
StringBuffer
jsonBuf
=
new
StringBuffer
();
Completer
<
Map
<
String
,
double
>>
completer
=
new
Completer
<
Map
<
String
,
double
>>();
StreamSubscription
<
String
>
stdoutSub
;
int
prefixLength
=
0
;
stdoutSub
=
process
.
stdout
.
transform
(
const
Utf8Decoder
())
.
transform
(
const
LineSplitter
())
.
listen
((
String
line
)
{
print
(
line
);
if
(
line
.
contains
(
jsonStart
))
{
jsonStarted
=
true
;
prefixLength
=
line
.
indexOf
(
jsonStart
);
return
;
}
if
(
line
.
contains
(
jsonEnd
))
{
jsonStarted
=
false
;
stdoutSub
.
cancel
();
process
.
kill
(
ProcessSignal
.
SIGINT
);
// flutter run doesn't quit automatically
completer
.
complete
(
JSON
.
decode
(
jsonBuf
.
toString
()));
return
;
}
if
(
jsonStarted
)
jsonBuf
.
writeln
(
line
.
substring
(
prefixLength
));
});
return
completer
.
future
;
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
await
task
(
createMicrobenchmarkTask
());
}
dev/devicelab/bin/tasks/microbenchmarks_ios.dart
0 → 100644
View file @
42ccffca
// Copyright 2017 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/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/tasks/microbenchmarks.dart'
;
/// Runs microbenchmarks on iOS.
Future
<
Null
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
await
task
(
createMicrobenchmarkTask
());
}
dev/devicelab/lib/tasks/microbenchmarks.dart
0 → 100644
View file @
42ccffca
// Copyright 2017 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
'dart:convert'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'package:flutter_devicelab/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
/// Creates a device lab task that runs benchmarks in
/// `dev/benchmarks/microbenchmarks` reports results to the dashboard.
TaskFunction
createMicrobenchmarkTask
(
)
{
return
()
async
{
Device
device
=
await
devices
.
workingDevice
;
await
device
.
unlock
();
Future
<
Map
<
String
,
double
>>
_runMicrobench
(
String
benchmarkPath
)
async
{
print
(
'Running
$benchmarkPath
'
);
Directory
appDir
=
dir
(
path
.
join
(
flutterDirectory
.
path
,
'dev/benchmarks/microbenchmarks'
));
Process
flutterProcess
=
await
inDirectory
(
appDir
,
()
async
{
return
await
_startFlutter
(
options:
<
String
>[
'--profile'
,
// --release doesn't work on iOS due to code signing issues
'-d'
,
device
.
deviceId
,
benchmarkPath
,
],
canFail:
false
,
);
});
return
await
_readJsonResults
(
flutterProcess
);
}
Map
<
String
,
double
>
allResults
=
<
String
,
double
>{};
allResults
.
addAll
(
await
_runMicrobench
(
'lib/stocks/layout_bench.dart'
));
allResults
.
addAll
(
await
_runMicrobench
(
'lib/stocks/build_bench.dart'
));
allResults
.
addAll
(
await
_runMicrobench
(
'lib/gestures/velocity_tracker_bench.dart'
));
if
(
deviceOperatingSystem
==
DeviceOperatingSystem
.
android
)
{
// TODO(yjbanov): Run on iOS when https://github.com/flutter/flutter/issues/7433 is fixed.
allResults
.
addAll
(
await
_runMicrobench
(
'lib/stocks/animation_bench.dart'
));
}
return
new
TaskResult
.
success
(
allResults
,
benchmarkScoreKeys:
allResults
.
keys
.
toList
());
};
}
Future
<
Process
>
_startFlutter
({
String
command
=
'run'
,
List
<
String
>
options:
const
<
String
>[],
bool
canFail:
false
,
Map
<
String
,
String
>
env
})
{
List
<
String
>
args
=
<
String
>[
'run'
]..
addAll
(
options
);
return
startProcess
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
args
,
env:
env
);
}
Future
<
Map
<
String
,
double
>>
_readJsonResults
(
Process
process
)
{
// IMPORTANT: keep these values in sync with dev/benchmarks/microbenchmarks/lib/common.dart
const
String
jsonStart
=
'================ RESULTS ================'
;
const
String
jsonEnd
=
'================ FORMATTED =============='
;
bool
jsonStarted
=
false
;
StringBuffer
jsonBuf
=
new
StringBuffer
();
Completer
<
Map
<
String
,
double
>>
completer
=
new
Completer
<
Map
<
String
,
double
>>();
StreamSubscription
<
String
>
stdoutSub
;
int
prefixLength
=
0
;
stdoutSub
=
process
.
stdout
.
transform
(
const
Utf8Decoder
())
.
transform
(
const
LineSplitter
())
.
listen
((
String
line
)
{
print
(
line
);
if
(
line
.
contains
(
jsonStart
))
{
jsonStarted
=
true
;
prefixLength
=
line
.
indexOf
(
jsonStart
);
return
;
}
if
(
line
.
contains
(
jsonEnd
))
{
jsonStarted
=
false
;
stdoutSub
.
cancel
();
process
.
kill
(
ProcessSignal
.
SIGINT
);
// flutter run doesn't quit automatically
completer
.
complete
(
JSON
.
decode
(
jsonBuf
.
toString
()));
return
;
}
if
(
jsonStarted
)
jsonBuf
.
writeln
(
line
.
substring
(
prefixLength
));
});
return
completer
.
future
;
}
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