Merge "Perfprofd: Update proto config"
diff --git a/perfprofd/configreader.cc b/perfprofd/configreader.cc
index b130399..8bdd081 100644
--- a/perfprofd/configreader.cc
+++ b/perfprofd/configreader.cc
@@ -324,4 +324,7 @@
config->collect_charging_state = getBoolValue("collect_charging_state");
config->collect_booting = getBoolValue("collect_booting");
config->collect_camera_active = getBoolValue("collect_camera_active");
+
+ config->process = -1;
+ config->use_elf_symbolizer = true;
}
diff --git a/perfprofd/perfprofd_binder.cc b/perfprofd/perfprofd_binder.cc
index 040265e..11d17ff 100644
--- a/perfprofd/perfprofd_binder.cc
+++ b/perfprofd/perfprofd_binder.cc
@@ -217,6 +217,7 @@
CHECK_AND_COPY_FROM_PROTO(collect_booting)
CHECK_AND_COPY_FROM_PROTO(collect_camera_active)
CHECK_AND_COPY_FROM_PROTO(process)
+ CHECK_AND_COPY_FROM_PROTO(use_elf_symbolizer)
#undef CHECK_AND_COPY_FROM_PROTO
};
return StartProfiling(config_fn);
diff --git a/perfprofd/perfprofd_config.proto b/perfprofd/perfprofd_config.proto
index 8f9f5d1..ae3aee9 100644
--- a/perfprofd/perfprofd_config.proto
+++ b/perfprofd/perfprofd_config.proto
@@ -70,4 +70,7 @@
// The pid of the process to profile. May be negative, in which case
// the whole system will be profiled.
optional int32 process = 18;
+
+ // Whether to use a symbolizer on-device.
+ optional bool use_elf_symbolizer = 19;
};
diff --git a/perfprofd/scripts/perf_config_proto.py b/perfprofd/scripts/perf_config_proto.py
index c6795ab..11456a2 100644
--- a/perfprofd/scripts/perf_config_proto.py
+++ b/perfprofd/scripts/perf_config_proto.py
@@ -23,13 +23,69 @@
import sys
-config = perfprofd_config_pb2.ProfilingConfig()
+config_options = [
+ ('collection_interval_in_s', 'u'),
+ ('use_fixed_seed', 'u'),
+ ('main_loop_iterations', 'u'),
+ ('destination_directory', 's'),
+ ('config_directory', 's'),
+ ('perf_path', 's'),
+ ('sampling_period', 'u'),
+ ('sample_duration_in_s', 'u'),
+ ('only_debug_build', 'b'),
+ ('hardwire_cpus', 'b'),
+ ('hardwire_cpus_max_duration_in_s', 'u'),
+ ('max_unprocessed_profiles', 'u'),
+ ('stack_profile', 'b'),
+ ('collect_cpu_utilization', 'b'),
+ ('collect_charging_state', 'b'),
+ ('collect_booting', 'b'),
+ ('collect_camera_active', 'b'),
+ ('process', 'i'),
+ ('use_elf_symbolizer', 'b'),
+]
-config.collection_interval_in_s = 10
-config.sample_duration_in_s = 5
-config.main_loop_iterations = 1
-config.process = 784
+def collect_and_write(filename):
+ config = perfprofd_config_pb2.ProfilingConfig()
-f = open(sys.argv[1], "wb")
-f.write(config.SerializeToString())
-f.close()
+ for (option, option_type) in config_options:
+ input = raw_input('%s(%s): ' % (option, option_type))
+ if input == '':
+ # Skip this argument.
+ continue
+ elif input == '!':
+ # Special-case input, end argument collection.
+ break
+ # Now do some actual parsing work.
+ if option_type == 'u' or option_type == 'i':
+ option_val = int(input)
+ elif option_type == 'b':
+ if input == '1' or input == 't' or input == 'true':
+ option_val = True
+ elif input == '0' or input == 'f' or input == 'false':
+ option_val = False
+ else:
+ assert False, 'Unknown boolean %s' % input
+ else:
+ assert False, 'Unknown type %s' % type
+ setattr(config, option, option_val)
+
+ f = open(filename, "wb")
+ f.write(config.SerializeToString())
+ f.close()
+
+def read_and_print(filename):
+ config = perfprofd_config_pb2.ProfilingConfig()
+
+ f = open(filename, "rb")
+ config.ParseFromString(f.read())
+ f.close()
+
+ print config
+
+if sys.argv[1] == 'read':
+ read_and_print(sys.argv[2])
+elif sys.argv[1] == 'write':
+ collect_and_write(sys.argv[2])
+else:
+ print 'Usage: python perf_config_proto.py (read|write) filename'