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
2e8315e8
Commit
2e8315e8
authored
May 11, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate a Gallery demo transition-durations performance histogram (#3859)
parent
2aab6b56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
7 deletions
+47
-7
transitions_perf_test.dart
...es/flutter_gallery/test_driver/transitions_perf_test.dart
+47
-7
No files found.
examples/flutter_gallery/test_driver/transitions_perf_test.dart
View file @
2e8315e8
...
...
@@ -3,8 +3,12 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:convert'
show
JsonEncoder
;
import
'package:file/file.dart'
;
import
'package:file/io.dart'
;
import
'package:flutter_driver/flutter_driver.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
// Warning: the following strings must be kept in sync with GalleryHome.
...
...
@@ -46,6 +50,41 @@ const List<String> demoNames = const <String>[
'Typography'
];
Future
<
Null
>
saveDurationsHistogram
(
List
<
Map
<
String
,
dynamic
>>
events
)
async
{
final
Map
<
String
,
List
<
int
>>
durations
=
new
Map
<
String
,
List
<
int
>>();
Map
<
String
,
dynamic
>
startEvent
;
// Save the duration of the first frame after each 'Start Transition' event.
for
(
Map
<
String
,
dynamic
>
event
in
events
)
{
final
String
eventName
=
event
[
'name'
];
if
(
eventName
==
'Start Transition'
)
{
assert
(
startEvent
==
null
);
startEvent
=
event
;
}
else
if
(
startEvent
!=
null
&&
eventName
==
'Frame'
)
{
final
String
routeName
=
startEvent
[
'args'
][
'to'
];
durations
[
routeName
]
??=
new
List
<
int
>();
durations
[
routeName
].
add
(
event
[
'dur'
]);
startEvent
=
null
;
}
}
// Verify that the durations data is valid.
if
(
durations
.
keys
.
isEmpty
)
throw
'no "Start Transition" timeline events found'
;
for
(
String
routeName
in
durations
.
keys
)
{
if
(
durations
[
routeName
]
==
null
||
durations
[
routeName
].
length
!=
2
)
throw
'invalid timeline data for
$routeName
transition'
;
}
// Save the durations Map to a file.
final
String
destinationDirectory
=
'build'
;
final
FileSystem
fs
=
new
LocalFileSystem
();
await
fs
.
directory
(
destinationDirectory
).
create
(
recursive:
true
);
final
File
file
=
fs
.
file
(
path
.
join
(
destinationDirectory
,
'transition_durations.timeline.json'
));
await
file
.
writeAsString
(
new
JsonEncoder
.
withIndent
(
' '
).
convert
(
durations
));
}
void
main
(
)
{
group
(
'flutter gallery transitions'
,
()
{
FlutterDriver
driver
;
...
...
@@ -81,13 +120,14 @@ void main() {
}
},
streams:
const
<
TimelineStream
>[
TimelineStream
.
dart
,
TimelineStream
.
gc
,
TimelineStream
.
compiler
TimelineStream
.
dart
]);
new
TimelineSummary
.
summarize
(
timeline
)
..
writeSummaryToFile
(
'transitions_perf'
,
pretty:
true
)
..
writeTimelineToFile
(
'transitions_perf'
,
pretty:
true
);
},
timeout:
new
Timeout
(
new
Duration
(
minutes:
15
)));
// Save the duration (in microseconds) of the first timeline Frame event
// that follows a 'Start Transition' event. The Gallery app adds a
// 'Start Transition' event when a demo is launched (see GalleryItem).
saveDurationsHistogram
(
timeline
.
json
[
'traceEvents'
]);
},
timeout:
new
Timeout
(
new
Duration
(
minutes:
5
)));
});
}
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