OLD | NEW |
1 #!mojo mojo:dart_content_handler | 1 #!mojo mojo:dart_content_handler |
2 // Copyright 2015 The Chromium Authors. All rights reserved. | 2 // Copyright 2015 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:developer'; |
7 | 8 |
8 import 'package:common/tracing_helper.dart'; | |
9 import 'package:mojo/application.dart'; | 9 import 'package:mojo/application.dart'; |
10 import 'package:mojo/core.dart'; | 10 import 'package:mojo/core.dart'; |
11 | 11 |
12 class StartupBenchmarkApp extends Application { | 12 class StartupBenchmarkApp extends Application { |
13 TracingHelper _tracing; | |
14 Timer _timer; | |
15 | |
16 StartupBenchmarkApp.fromHandle(MojoHandle handle) : super.fromHandle(handle); | 13 StartupBenchmarkApp.fromHandle(MojoHandle handle) : super.fromHandle(handle); |
17 | 14 |
18 void initialize(List<String> args, String url) { | 15 void initialize(List<String> args, String url) { |
19 // This sets up a connection between this application and the Mojo | 16 Timeline.instantSync("initialized"); |
20 // tracing service. | |
21 _tracing = new TracingHelper.fromApplication( | |
22 this, "example_traced_application", TraceSendTiming.AT_END); | |
23 _tracing.traceInstant("initialized", "traced_application"); | |
24 } | 17 } |
25 | 18 |
26 @override | 19 @override |
27 void acceptConnection(String requestorUrl, String resolvedUrl, | 20 void acceptConnection(String requestorUrl, String resolvedUrl, |
28 ApplicationConnection connection) { | 21 ApplicationConnection connection) { |
29 _tracing.traceInstant("connected", "traced_application"); | 22 Timeline.instantSync("connected"); |
30 } | 23 } |
31 } | 24 } |
32 | 25 |
33 main(List args) { | 26 main(List args) { |
34 MojoHandle appHandle = new MojoHandle(args[0]); | 27 MojoHandle appHandle = new MojoHandle(args[0]); |
35 new StartupBenchmarkApp.fromHandle(appHandle); | 28 new StartupBenchmarkApp.fromHandle(appHandle); |
36 } | 29 } |
OLD | NEW |