| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // categories targeted in measurements. | 71 // categories targeted in measurements. |
| 72 std::string ComputeCategoriesStr() { | 72 std::string ComputeCategoriesStr() { |
| 73 std::set<std::string> category_set; | 73 std::set<std::string> category_set; |
| 74 for (const Measurement& measurement : args_.measurements) { | 74 for (const Measurement& measurement : args_.measurements) { |
| 75 std::vector<std::string> categories; | 75 std::vector<std::string> categories; |
| 76 base::SplitString(measurement.target_event.categories, ',', &categories); | 76 base::SplitString(measurement.target_event.categories, ',', &categories); |
| 77 category_set.insert(categories.begin(), categories.end()); | 77 category_set.insert(categories.begin(), categories.end()); |
| 78 } | 78 } |
| 79 std::vector<std::string> unique_categories(category_set.begin(), | 79 std::vector<std::string> unique_categories(category_set.begin(), |
| 80 category_set.end()); | 80 category_set.end()); |
| 81 return JoinString(unique_categories, ','); | 81 return base::JoinString(unique_categories, ","); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void StartTracedApplication(mojo::ApplicationImpl* app) { | 84 void StartTracedApplication(mojo::ApplicationImpl* app) { |
| 85 // Record the time origin for measurements just before connecting to the app | 85 // Record the time origin for measurements just before connecting to the app |
| 86 // being benchmarked. | 86 // being benchmarked. |
| 87 time_origin_ = base::TimeTicks::FromInternalValue(MojoGetTimeTicksNow()); | 87 time_origin_ = base::TimeTicks::FromInternalValue(MojoGetTimeTicksNow()); |
| 88 traced_app_connection_ = app->ConnectToApplication(args_.app); | 88 traced_app_connection_ = app->ConnectToApplication(args_.app); |
| 89 | 89 |
| 90 // Post task to stop tracing when the time is up. | 90 // Post task to stop tracing when the time is up. |
| 91 base::MessageLoop::current()->PostDelayedTask( | 91 base::MessageLoop::current()->PostDelayedTask( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 }; | 155 }; |
| 156 } // namespace | 156 } // namespace |
| 157 } // namespace benchmark | 157 } // namespace benchmark |
| 158 | 158 |
| 159 MojoResult MojoMain(MojoHandle application_request) { | 159 MojoResult MojoMain(MojoHandle application_request) { |
| 160 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp); | 160 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp); |
| 161 auto ret = runner.Run(application_request); | 161 auto ret = runner.Run(application_request); |
| 162 fflush(nullptr); | 162 fflush(nullptr); |
| 163 return ret; | 163 return ret; |
| 164 } | 164 } |
| OLD | NEW |