diff options
author | Andreas Gampe <agampe@google.com> | 2018-04-30 16:55:15 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2018-05-03 13:34:39 -0700 |
commit | 18e09166a52b4377009e8b199823963df1936dcc (patch) | |
tree | 0e42dc84f19b937068ce7f8bba0b292ba3280cfd | |
parent | 70f5f6faa2678dee412ba5a1ab1343d6fd6a6141 (diff) | |
download | extras-18e09166a52b4377009e8b199823963df1936dcc.tar.gz |
Perfprofd: Minor fixes
Set the allowed minimum for collection_interval to 0.
Copy the sampling_frequency.
Add "-m 8192" when call-stacks are requested.
(cherry picked from commit 59a18215031faedc4bbee70baef363299cec0b69)
Bug: 73175642
Test: mmma system/extras/perfprofd
Test: perfprofd_test
Merged-In: I8fd41da08eb14dadc98b85afe1e4dbed2d9bc9b1
Change-Id: I8fd41da08eb14dadc98b85afe1e4dbed2d9bc9b1
-rw-r--r-- | perfprofd/configreader.cc | 3 | ||||
-rw-r--r-- | perfprofd/perfprofdcore.cc | 7 | ||||
-rw-r--r-- | perfprofd/tests/perfprofd_test.cc | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/perfprofd/configreader.cc b/perfprofd/configreader.cc index f2b60788..def3f18f 100644 --- a/perfprofd/configreader.cc +++ b/perfprofd/configreader.cc @@ -70,7 +70,7 @@ void ConfigReader::addDefaultEntries() // set to 100, then over time we want to see a perf profile // collected every 100 seconds). The actual time within the interval // for the collection is chosen randomly. - addUnsignedEntry("collection_interval", config.collection_interval_in_s, 1, UINT32_MAX); + addUnsignedEntry("collection_interval", config.collection_interval_in_s, 0, UINT32_MAX); // Use the specified fixed seed for random number generation (unit // testing) @@ -337,6 +337,7 @@ void ConfigReader::FillConfig(Config* config) { config->perf_path = getStringValue("perf_path"); config->sampling_period = getUnsignedValue("sampling_period"); + config->sampling_frequency = getUnsignedValue("sampling_frequency"); config->sample_duration_in_s = getUnsignedValue("sample_duration"); diff --git a/perfprofd/perfprofdcore.cc b/perfprofd/perfprofdcore.cc index c5605ac7..73332a3f 100644 --- a/perfprofd/perfprofdcore.cc +++ b/perfprofd/perfprofdcore.cc @@ -481,7 +481,7 @@ static PROFILE_RESULT invoke_perf(Config& config, } // marshall arguments - constexpr unsigned max_args = 15; + constexpr unsigned max_args = 17; const char *argv[max_args]; unsigned slot = 0; argv[slot++] = perf_path.c_str(); @@ -504,8 +504,11 @@ static PROFILE_RESULT invoke_perf(Config& config, } // -g if desired - if (stack_profile_opt) + if (stack_profile_opt) { argv[slot++] = stack_profile_opt; + argv[slot++] = "-m"; + argv[slot++] = "8192"; + } std::string pid_str; if (config.process < 0) { diff --git a/perfprofd/tests/perfprofd_test.cc b/perfprofd/tests/perfprofd_test.cc index 6c5c2783..a96fd710 100644 --- a/perfprofd/tests/perfprofd_test.cc +++ b/perfprofd/tests/perfprofd_test.cc @@ -613,7 +613,6 @@ TEST_F(PerfProfdTest, ConfigFileParsing) runner.addToConfig("destination_directory=/does/not/exist"); // assorted bad syntax - runner.addToConfig("collection_interval=0"); runner.addToConfig("collection_interval=-1"); runner.addToConfig("nonexistent_key=something"); runner.addToConfig("no_equals_stmt"); @@ -626,10 +625,9 @@ TEST_F(PerfProfdTest, ConfigFileParsing) // Verify log contents const std::string expected = RAW_RESULT( - W: line 6: specified value 0 for 'collection_interval' outside permitted range [1 4294967295] (ignored) - W: line 7: malformed unsigned value (ignored) - W: line 8: unknown option 'nonexistent_key' ignored - W: line 9: line malformed (no '=' found) + W: line 6: malformed unsigned value (ignored) + W: line 7: unknown option 'nonexistent_key' ignored + W: line 8: line malformed (no '=' found) ); // check to make sure log excerpt matches |