Chromium Code Reviews| Index: apps/benchmark/benchmark_app.cc |
| diff --git a/apps/benchmark/benchmark_app.cc b/apps/benchmark/benchmark_app.cc |
| index bfdc2998797f59a7cad54bf48fbf6771038267e0..8878810c1a9a7fbb1955d79aa164bd6e0d5a003a 100644 |
| --- a/apps/benchmark/benchmark_app.cc |
| +++ b/apps/benchmark/benchmark_app.cc |
| @@ -44,24 +44,18 @@ 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()); |
| + // Don't compute the categories string if all categories should be traced |
|
ppi
2015/10/29 13:33:43
End the comment with a period.
nelly
2015/10/29 14:20:17
Done.
|
| + std::string categories_str = "*"; |
| + if (!args_.trace_all_categories) { |
| + 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. |
| tracing::TraceCollectorPtr trace_collector; |
| app->ConnectToService("mojo:tracing", &trace_collector); |
| trace_collector_client_.reset( |
| - new TraceCollectorClient(this, trace_collector.Pass())); |
| + new TraceCollectorClient(this, trace_collector.Pass())); |
|
etiennej
2015/10/29 13:35:51
Beware of your whitespace.
qsr
2015/10/29 13:40:49
Using 'git cl format' should use clang to format y
nelly
2015/10/29 14:20:17
Done.
|
| trace_collector_client_->Start(categories_str); |
| // Start tracing the application with 1 sec of delay. |
| @@ -69,7 +63,21 @@ class BenchmarkApp : public mojo::ApplicationDelegate, |
| FROM_HERE, |
| base::Bind(&BenchmarkApp::StartTracedApplication, |
| base::Unretained(this), app), |
| - base::TimeDelta::FromSeconds(1)); |
| + base::TimeDelta::FromMilliseconds(1000)); |
| + } |
| + |
| + // Compute the string of trace categories we want to collect: a union of all |
|
ppi
2015/10/29 13:33:43
Function comments should be "third-person", ie. "C
nelly
2015/10/29 14:20:17
Done.
|
| + // 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) { |