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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 FROM_HERE, base::Bind(&BenchmarkApp::StartTracedApplication, | 68 FROM_HERE, base::Bind(&BenchmarkApp::StartTracedApplication, |
69 base::Unretained(this), app), | 69 base::Unretained(this), app), |
70 base::TimeDelta::FromSeconds(1)); | 70 base::TimeDelta::FromSeconds(1)); |
71 } | 71 } |
72 | 72 |
73 // Computes the string of trace categories we want to collect: a union of all | 73 // Computes the string of trace categories we want to collect: a union of all |
74 // categories targeted in measurements. | 74 // categories targeted in measurements. |
75 std::string ComputeCategoriesStr() { | 75 std::string ComputeCategoriesStr() { |
76 std::set<std::string> category_set; | 76 std::set<std::string> category_set; |
77 for (const Measurement& measurement : args_.measurements) { | 77 for (const Measurement& measurement : args_.measurements) { |
78 std::vector<std::string> categories; | 78 std::vector<std::string> categories = |
79 base::SplitString(measurement.target_event.categories, ',', &categories); | 79 base::SplitString(measurement.target_event.categories, ",", |
| 80 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
80 category_set.insert(categories.begin(), categories.end()); | 81 category_set.insert(categories.begin(), categories.end()); |
81 } | 82 } |
82 std::vector<std::string> unique_categories(category_set.begin(), | 83 std::vector<std::string> unique_categories(category_set.begin(), |
83 category_set.end()); | 84 category_set.end()); |
84 return base::JoinString(unique_categories, ","); | 85 return base::JoinString(unique_categories, ","); |
85 } | 86 } |
86 | 87 |
87 void StartTracedApplication(mojo::ApplicationImpl* app) { | 88 void StartTracedApplication(mojo::ApplicationImpl* app) { |
88 // Record the time origin for measurements just before connecting to the app | 89 // Record the time origin for measurements just before connecting to the app |
89 // being benchmarked. | 90 // being benchmarked. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 }; | 160 }; |
160 } // namespace | 161 } // namespace |
161 } // namespace benchmark | 162 } // namespace benchmark |
162 | 163 |
163 MojoResult MojoMain(MojoHandle application_request) { | 164 MojoResult MojoMain(MojoHandle application_request) { |
164 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp); | 165 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp); |
165 auto ret = runner.Run(application_request); | 166 auto ret = runner.Run(application_request); |
166 fflush(nullptr); | 167 fflush(nullptr); |
167 return ret; | 168 return ret; |
168 } | 169 } |
OLD | NEW |