Chromium Code Reviews| Index: apps/benchmark/benchmark_app.cc |
| diff --git a/apps/benchmark/benchmark_app.cc b/apps/benchmark/benchmark_app.cc |
| index bd7c8a99b1269a2b751dc0f282efde5321e2a9c6..325f11244f5881a9b89d268202ef148555fba885 100644 |
| --- a/apps/benchmark/benchmark_app.cc |
| +++ b/apps/benchmark/benchmark_app.cc |
| @@ -44,17 +44,12 @@ class BenchmarkApp : public mojo::ApplicationDelegate, |
| return; |
| } |
| - // Calculate a list of trace categories we want to collect: a union of all |
| - // categories targeted in measurements. |
| - std::set<std::string> category_set; |
| - for (const Measurement& measurement : args_.measurements) { |
| - std::vector<std::string> categories; |
| - base::SplitString(measurement.target_event.categories, ',', &categories); |
| - category_set.insert(categories.begin(), categories.end()); |
| + // Trace all categories when results will be written in a file. No need |
| + // to compute the categories string in that case (using "*" instead). |
| + std::string categories_str = "*"; |
| + if (!args_.write_output_file) { |
|
ppi
2015/10/12 19:30:52
I'd argue that we should record all categories ind
|
| + categories_str = ComputeCategoriesStr(); |
| } |
| - std::vector<std::string> unique_categories(category_set.begin(), |
| - category_set.end()); |
| - std::string categories_str = JoinString(unique_categories, ','); |
| // Connect to trace collector, which will fetch the trace events produced by |
| // the app being benchmarked. |
| @@ -66,12 +61,25 @@ class BenchmarkApp : public mojo::ApplicationDelegate, |
| // Start tracing the application with 1 sec of delay. |
| base::MessageLoop::current()->PostDelayedTask( |
| - FROM_HERE, |
| - base::Bind(&BenchmarkApp::StartTracedApplication, |
| - base::Unretained(this), app), |
| + FROM_HERE, base::Bind(&BenchmarkApp::StartTracedApplication, |
| + base::Unretained(this), app), |
| base::TimeDelta::FromSeconds(1)); |
| } |
| + // Calculate a list of trace categories we want to collect: a union of all |
| + // categories targeted in measurements. |
| + std::string ComputeCategoriesStr() { |
| + std::set<std::string> category_set; |
| + for (const Measurement& measurement : args_.measurements) { |
| + std::vector<std::string> categories; |
| + base::SplitString(measurement.target_event.categories, ',', &categories); |
| + category_set.insert(categories.begin(), categories.end()); |
| + } |
| + std::vector<std::string> unique_categories(category_set.begin(), |
| + category_set.end()); |
| + return JoinString(unique_categories, ','); |
| + } |
| + |
| void StartTracedApplication(mojo::ApplicationImpl* app) { |
| // Record the time origin for measurements just before connecting to the app |
| // being benchmarked. |