Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: apps/benchmark/benchmark_app.cc

Issue 1391013005: Benchmark: `--save-all-traces` argument (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Benchmark Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/devtools/common/mojo_benchmark » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/benchmark/benchmark_app.cc
diff --git a/apps/benchmark/benchmark_app.cc b/apps/benchmark/benchmark_app.cc
index bfdc2998797f59a7cad54bf48fbf6771038267e0..7a3db357894ed9b2796656591cc80d2deebe1f9b 100644
--- a/apps/benchmark/benchmark_app.cc
+++ b/apps/benchmark/benchmark_app.cc
@@ -44,17 +44,11 @@ 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.
+ std::string categories_str = "*";
+ if (!args_.write_output_file) {
ppi 2015/10/29 16:02:09 nit: it's a bit weird to set the initial value to
nelly 2015/10/29 16:48:22 Done.
+ 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,10 +60,23 @@ 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),
- base::TimeDelta::FromSeconds(1));
+ FROM_HERE, base::Bind(&BenchmarkApp::StartTracedApplication,
+ base::Unretained(this), app),
+ base::TimeDelta::FromMilliseconds(1000));
ppi 2015/10/29 16:02:09 Why the change from s to ms?
nelly 2015/10/29 16:48:22 Done.
+ }
+
+ // Computes the string 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) {
« no previous file with comments | « no previous file | mojo/devtools/common/mojo_benchmark » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698