| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <memory> | 5 #include <memory> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/benchmark/event.h" | 10 #include "apps/benchmark/event.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 std::vector<std::string> unique_categories(category_set.begin(), | 82 std::vector<std::string> unique_categories(category_set.begin(), |
| 83 category_set.end()); | 83 category_set.end()); |
| 84 return base::JoinString(unique_categories, ","); | 84 return base::JoinString(unique_categories, ","); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void StartTracedApplication() { | 87 void StartTracedApplication() { |
| 88 // Record the time origin for measurements just before connecting to the app | 88 // Record the time origin for measurements just before connecting to the app |
| 89 // being benchmarked. | 89 // being benchmarked. |
| 90 time_origin_ = base::TimeTicks::FromInternalValue(MojoGetTimeTicksNow()); | 90 time_origin_ = base::TimeTicks::FromInternalValue(MojoGetTimeTicksNow()); |
| 91 shell()->ConnectToApplication(args_.app, GetProxy(&traced_app_connection_), | 91 shell()->ConnectToApplication(args_.app, GetProxy(&traced_app_connection_)); |
| 92 nullptr); | |
| 93 | 92 |
| 94 // Post task to stop tracing when the time is up. | 93 // Post task to stop tracing when the time is up. |
| 95 base::MessageLoop::current()->PostDelayedTask( | 94 base::MessageLoop::current()->PostDelayedTask( |
| 96 FROM_HERE, | 95 FROM_HERE, |
| 97 base::Bind(&BenchmarkApp::StopTracing, base::Unretained(this)), | 96 base::Bind(&BenchmarkApp::StopTracing, base::Unretained(this)), |
| 98 args_.duration); | 97 args_.duration); |
| 99 } | 98 } |
| 100 | 99 |
| 101 void StopTracing() { | 100 void StopTracing() { |
| 102 // Request the trace collector to send back the data. When the data is ready | 101 // Request the trace collector to send back the data. When the data is ready |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } // namespace | 159 } // namespace |
| 161 } // namespace benchmark | 160 } // namespace benchmark |
| 162 | 161 |
| 163 MojoResult MojoMain(MojoHandle application_request) { | 162 MojoResult MojoMain(MojoHandle application_request) { |
| 164 mojo::ScopedChromiumInit init; | 163 mojo::ScopedChromiumInit init; |
| 165 benchmark::BenchmarkApp benchmark_app; | 164 benchmark::BenchmarkApp benchmark_app; |
| 166 auto ret = mojo::RunApplication(application_request, &benchmark_app); | 165 auto ret = mojo::RunApplication(application_request, &benchmark_app); |
| 167 fflush(nullptr); | 166 fflush(nullptr); |
| 168 return ret; | 167 return ret; |
| 169 } | 168 } |
| OLD | NEW |