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

Issue 2927593002: Make stack sampling profiler sample beyond startup. (Closed)

Created:
3 years, 6 months ago by Alexei Svitkine (slow)
Modified:
3 years, 5 months ago
CC:
chromium-reviews, danakj+watch_chromium.org, asvitkine+watch_chromium.org, vmpstr+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make stack sampling profiler sample beyond startup. This expands the base sampling profiler API to make the client callback to be able to return new sampling params if another profiling collection should be started. Additionally, converts sampling profiler reporting to use a base::Feature rather than a field trial directly and adds a base::Feature param that specifies whether this new functionality should be used to do periodic sampling (at 1s intervals). This new functionality is not on by default, but can be enabled via a field trial. The new periodic samples will be added to UMA logs as they're received and will have PERIODIC_COLLECTION trigger specified in the proto. Adds a test for the new base profiler functionality. Also, updates profile_duration for non-periodic profiles to include the sampling_period, as that was previously not accounted for. Also fixes some existing lint warnings. BUG=735182 Review-Url: https://codereview.chromium.org/2927593002 Cr-Commit-Position: refs/heads/master@{#486906} Committed: https://chromium.googlesource.com/chromium/src/+/2d8b08c72cac89549268a67996c387323895ce22

Patch Set 1 #

Total comments: 4

Patch Set 2 : Fix gn check also revert local change from testing. #

Patch Set 3 : rebase + PROFILER_TEST_F #

Total comments: 10

Patch Set 4 : rebase #

Patch Set 5 : Address some comments. #

Total comments: 6

Patch Set 6 : rebase #

Patch Set 7 : fix compile #

Patch Set 8 : Use base::Optional for callback return value. #

Patch Set 9 : Address comments. #

Patch Set 10 : Address comments. #

Total comments: 9

Patch Set 11 : more comments #

Total comments: 10

Patch Set 12 : rebase #

Patch Set 13 : Add TODO. Move sampling_profiler_params_ to chrome_browser_main. #

Total comments: 6

Patch Set 14 : rebase #

Patch Set 15 : Address comments. #

Total comments: 6

Patch Set 16 : Address more comments. #

Patch Set 17 : Address more comments. #

Total comments: 1

Patch Set 18 : Add test + some other comments. #

Patch Set 19 : Remove change to chrome/common/DEPS #

Patch Set 20 : fix some lint warnings #

Total comments: 2

Patch Set 21 : Move sampling params to call_stack_profile_metrics_provider.cc; make some things constexpr to avoid… #

Total comments: 2

Patch Set 22 : Make function internal. #

Patch Set 23 : Fix checks to exclude iOS for uptime. #

Patch Set 24 : Reduce delay in base unit test. #

Patch Set 25 : Temporary LOG statements for debugging. #

Total comments: 1

Patch Set 26 : Use WaitableEvent::ResetPolicy::AUTOMATIC in unit test. (Debug logging not yet removed.) #

Patch Set 27 : Remove debug log statements. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+533 lines, -241 lines) Patch
M base/profiler/stack_sampling_profiler.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +9 lines, -3 lines 0 comments Download
M base/profiler/stack_sampling_profiler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 25 26 15 chunks +69 lines, -38 lines 0 comments Download
M base/profiler/stack_sampling_profiler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +61 lines, -5 lines 0 comments Download
M base/time/time.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/chrome_browser_main.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/chrome_browser_main.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +5 lines, -10 lines 0 comments Download
M components/metrics/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +4 lines, -1 line 0 comments Download
M components/metrics/call_stack_profile_collector.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +4 lines, -1 line 0 comments Download
M components/metrics/call_stack_profile_metrics_provider.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +30 lines, -14 lines 0 comments Download
M components/metrics/call_stack_profile_metrics_provider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 12 chunks +116 lines, -50 lines 0 comments Download
M components/metrics/call_stack_profile_metrics_provider_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 14 chunks +166 lines, -72 lines 0 comments Download
M components/metrics/call_stack_profile_params.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 chunks +24 lines, -5 lines 0 comments Download
D components/metrics/call_stack_profile_params.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +0 lines, -22 lines 0 comments Download
M components/metrics/child_call_stack_profile_collector.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +10 lines, -3 lines 0 comments Download
M components/metrics/child_call_stack_profile_collector.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +18 lines, -8 lines 0 comments Download
M components/metrics/child_call_stack_profile_collector_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +2 lines, -1 line 0 comments Download
M components/metrics/public/cpp/call_stack_profile_struct_traits.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 5 chunks +11 lines, -5 lines 0 comments Download
M components/metrics/public/interfaces/call_stack_profile_collector.mojom View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 107 (58 generated)
Alexei Svitkine (slow)
Hey Mike, This is finally ready-ish for review. There's still some small issues that I ...
3 years, 6 months ago (2017-06-20 20:57:39 UTC) #10
Mike Wittman
On 2017/06/20 20:57:39, Alexei Svitkine (very slow) wrote: > Hey Mike, > > This is ...
3 years, 6 months ago (2017-06-21 14:49:06 UTC) #19
Alexei Svitkine (slow)
On 2017/06/21 14:49:06, Mike Wittman wrote: > A few high-level comments before getting into details: ...
3 years, 5 months ago (2017-06-29 20:51:04 UTC) #20
Mike Wittman
On 2017/06/29 20:51:04, Alexei Svitkine (slow) wrote: > On 2017/06/21 14:49:06, Mike Wittman wrote: > ...
3 years, 5 months ago (2017-07-01 02:44:06 UTC) #21
Alexei Svitkine (slow)
https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h File chrome/common/stack_sampling_configuration.h (right): https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h#newcode33 chrome/common/stack_sampling_configuration.h:33: GetProfilerCallbackForCurrentProcess(); On 2017/07/01 02:44:06, Mike Wittman wrote: > On ...
3 years, 5 months ago (2017-07-06 15:51:09 UTC) #26
Mike Wittman
https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h File chrome/common/stack_sampling_configuration.h (right): https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h#newcode33 chrome/common/stack_sampling_configuration.h:33: GetProfilerCallbackForCurrentProcess(); On 2017/07/06 15:51:09, Alexei Svitkine (slow) wrote: > ...
3 years, 5 months ago (2017-07-06 17:25:53 UTC) #27
Alexei Svitkine (slow)
https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h File chrome/common/stack_sampling_configuration.h (right): https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h#newcode33 chrome/common/stack_sampling_configuration.h:33: GetProfilerCallbackForCurrentProcess(); On 2017/07/06 17:25:52, Mike Wittman wrote: > On ...
3 years, 5 months ago (2017-07-06 19:36:26 UTC) #28
Mike Wittman
https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h File chrome/common/stack_sampling_configuration.h (right): https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h#newcode33 chrome/common/stack_sampling_configuration.h:33: GetProfilerCallbackForCurrentProcess(); On 2017/07/06 19:36:25, Alexei Svitkine (slow) wrote: > ...
3 years, 5 months ago (2017-07-06 22:14:02 UTC) #29
Alexei Svitkine (slow)
(No changes since before, just discussion for now.) https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h File chrome/common/stack_sampling_configuration.h (right): https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h#newcode33 chrome/common/stack_sampling_configuration.h:33: GetProfilerCallbackForCurrentProcess(); ...
3 years, 5 months ago (2017-07-07 16:18:49 UTC) #30
Mike Wittman
https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h File chrome/common/stack_sampling_configuration.h (right): https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h#newcode33 chrome/common/stack_sampling_configuration.h:33: GetProfilerCallbackForCurrentProcess(); On 2017/07/07 16:18:48, Alexei Svitkine (slow) wrote: > ...
3 years, 5 months ago (2017-07-07 18:15:17 UTC) #31
Alexei Svitkine (slow)
PTAL https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h File chrome/common/stack_sampling_configuration.h (right): https://codereview.chromium.org/2927593002/diff/100001/chrome/common/stack_sampling_configuration.h#newcode33 chrome/common/stack_sampling_configuration.h:33: GetProfilerCallbackForCurrentProcess(); On 2017/07/07 18:15:17, Mike Wittman wrote: > ...
3 years, 5 months ago (2017-07-07 19:04:14 UTC) #34
Mike Wittman
https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc File base/profiler/stack_sampling_profiler.cc (left): https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc#oldcode500 base/profiler/stack_sampling_profiler.cc:500: size_t count = active_collections_.erase(collection->collection_id); The test code depends on ...
3 years, 5 months ago (2017-07-07 21:01:11 UTC) #35
Alexei Svitkine (slow)
https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc File base/profiler/stack_sampling_profiler.cc (left): https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc#oldcode500 base/profiler/stack_sampling_profiler.cc:500: size_t count = active_collections_.erase(collection->collection_id); On 2017/07/07 21:01:11, Mike Wittman ...
3 years, 5 months ago (2017-07-10 22:05:37 UTC) #37
Mike Wittman
https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc File base/profiler/stack_sampling_profiler.cc (left): https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc#oldcode500 base/profiler/stack_sampling_profiler.cc:500: size_t count = active_collections_.erase(collection->collection_id); On 2017/07/10 22:05:37, Alexei Svitkine ...
3 years, 5 months ago (2017-07-10 22:31:25 UTC) #40
Alexei Svitkine (slow)
https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc File base/profiler/stack_sampling_profiler.cc (left): https://codereview.chromium.org/2927593002/diff/320001/base/profiler/stack_sampling_profiler.cc#oldcode500 base/profiler/stack_sampling_profiler.cc:500: size_t count = active_collections_.erase(collection->collection_id); On 2017/07/10 22:31:25, Mike Wittman ...
3 years, 5 months ago (2017-07-11 18:27:05 UTC) #43
Mike Wittman
This looks good apart from the metrics provider test. https://codereview.chromium.org/2927593002/diff/400001/base/profiler/stack_sampling_profiler.cc File base/profiler/stack_sampling_profiler.cc (right): https://codereview.chromium.org/2927593002/diff/400001/base/profiler/stack_sampling_profiler.cc#newcode486 base/profiler/stack_sampling_profiler.cc:486: ...
3 years, 5 months ago (2017-07-11 21:41:52 UTC) #48
Mike Wittman
One other thought: should we stop collecting stacks after some time period so that we're ...
3 years, 5 months ago (2017-07-12 16:09:42 UTC) #49
Alexei Svitkine (slow)
I agree we may want something like this in the future. But I think in ...
3 years, 5 months ago (2017-07-12 17:17:03 UTC) #50
Alexei Svitkine (slow)
PTAL. Test added. I moved the GetUptime() helper to an internal namespace exposed from .h ...
3 years, 5 months ago (2017-07-12 20:06:21 UTC) #51
Mike Wittman
On 2017/07/12 20:06:21, Alexei Svitkine (slow) wrote: > PTAL. > > Test added. I moved ...
3 years, 5 months ago (2017-07-12 20:16:52 UTC) #54
Alexei Svitkine (slow)
+sky for chrome/browser OWNERS
3 years, 5 months ago (2017-07-12 20:59:44 UTC) #57
Alexei Svitkine (slow)
+rsesek from ipc/SECURITY_OWNERS for components/metrics/public/*
3 years, 5 months ago (2017-07-12 21:01:28 UTC) #61
Robert Sesek
mojom LGTM
3 years, 5 months ago (2017-07-12 21:09:08 UTC) #62
sky
https://codereview.chromium.org/2927593002/diff/460001/chrome/browser/chrome_browser_main.cc File chrome/browser/chrome_browser_main.cc (right): https://codereview.chromium.org/2927593002/diff/460001/chrome/browser/chrome_browser_main.cc#newcode643 chrome/browser/chrome_browser_main.cc:643: &sampling_profiler_params_)), It's rather error prone to have callers be ...
3 years, 5 months ago (2017-07-12 21:42:58 UTC) #65
Alexei Svitkine (slow)
Moved the params to call_stack_profile_metrics_provider.cc and made some things constexpr to avoid a static initializer. ...
3 years, 5 months ago (2017-07-13 17:58:22 UTC) #66
Mike Wittman
https://codereview.chromium.org/2927593002/diff/480001/components/metrics/call_stack_profile_metrics_provider.h File components/metrics/call_stack_profile_metrics_provider.h (right): https://codereview.chromium.org/2927593002/diff/480001/components/metrics/call_stack_profile_metrics_provider.h#newcode53 components/metrics/call_stack_profile_metrics_provider.h:53: static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( This can be made private or ...
3 years, 5 months ago (2017-07-13 18:10:29 UTC) #67
Alexei Svitkine (slow)
https://codereview.chromium.org/2927593002/diff/480001/components/metrics/call_stack_profile_metrics_provider.h File components/metrics/call_stack_profile_metrics_provider.h (right): https://codereview.chromium.org/2927593002/diff/480001/components/metrics/call_stack_profile_metrics_provider.h#newcode53 components/metrics/call_stack_profile_metrics_provider.h:53: static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( On 2017/07/13 18:10:29, Mike Wittman wrote: ...
3 years, 5 months ago (2017-07-13 18:36:15 UTC) #68
Alexei Svitkine (slow)
+thakis for base/ OWNERS (constexpr additions to time.h)
3 years, 5 months ago (2017-07-13 18:37:48 UTC) #70
Nico
lgtm
3 years, 5 months ago (2017-07-13 18:45:48 UTC) #71
Mike Wittman
lgtm
3 years, 5 months ago (2017-07-13 19:09:58 UTC) #72
sky
chrome/browser LGTM (thanks for moving ownership to the actual object).
3 years, 5 months ago (2017-07-13 20:38:55 UTC) #75
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2927593002/500001
3 years, 5 months ago (2017-07-13 20:40:45 UTC) #79
commit-bot: I haz the power
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/builds/258086)
3 years, 5 months ago (2017-07-13 21:53:08 UTC) #81
Alexei Svitkine (slow)
Hmm, StackSamplingProfilerTest.RescheduledByCallback (the new test I'm adding) fails on mac_chromium_rel_ng - but it passes for ...
3 years, 5 months ago (2017-07-14 17:05:02 UTC) #88
Robert Sesek
On 2017/07/14 17:05:02, Alexei Svitkine (slow) wrote: > Hmm, StackSamplingProfilerTest.RescheduledByCallback (the new test I'm adding) ...
3 years, 5 months ago (2017-07-14 17:07:54 UTC) #89
Alexei Svitkine (slow)
Ah, awesome! Thanks for that tidbit, looks like in this case: dcheck_always_on = true ffmpeg_branding ...
3 years, 5 months ago (2017-07-14 17:14:22 UTC) #90
Alexei Svitkine (slow)
And, unfortunately, still can't repro locally. I guess I'll do some try bot debugging with ...
3 years, 5 months ago (2017-07-14 17:31:03 UTC) #91
Robert Sesek
On 2017/07/14 17:31:03, Alexei Svitkine (slow) wrote: > And, unfortunately, still can't repro locally. I ...
3 years, 5 months ago (2017-07-14 17:59:07 UTC) #92
Alexei Svitkine (slow)
So logs from the bot indicates the second WaitableEvent::Signal() call doesn't cause the test's sampling_completed.Wait() ...
3 years, 5 months ago (2017-07-14 19:13:00 UTC) #93
Alexei Svitkine (slow)
Looks like I wasn't calling Reset() on the WaitableEvent which is required with the params ...
3 years, 5 months ago (2017-07-14 19:18:36 UTC) #94
Alexei Svitkine (slow)
Nevermind, we are calling Reset() on it ... from SaveProfilesAndReschedule(). Hmm. On Fri, Jul 14, ...
3 years, 5 months ago (2017-07-14 19:20:51 UTC) #95
Robert Sesek
https://codereview.chromium.org/2927593002/diff/560001/base/profiler/stack_sampling_profiler_unittest.cc File base/profiler/stack_sampling_profiler_unittest.cc (right): https://codereview.chromium.org/2927593002/diff/560001/base/profiler/stack_sampling_profiler_unittest.cc#newcode356 base/profiler/stack_sampling_profiler_unittest.cc:356: event->Reset(); I've just rewritten WaitableEvent on Mac and it's ...
3 years, 5 months ago (2017-07-14 19:22:39 UTC) #96
Alexei Svitkine (slow)
On 2017/07/14 19:22:39, Robert Sesek wrote: > https://codereview.chromium.org/2927593002/diff/560001/base/profiler/stack_sampling_profiler_unittest.cc > File base/profiler/stack_sampling_profiler_unittest.cc (right): > > https://codereview.chromium.org/2927593002/diff/560001/base/profiler/stack_sampling_profiler_unittest.cc#newcode356 ...
3 years, 5 months ago (2017-07-14 19:27:38 UTC) #97
Robert Sesek
On 2017/07/14 19:27:38, Alexei Svitkine (slow) wrote: > On 2017/07/14 19:22:39, Robert Sesek wrote: > ...
3 years, 5 months ago (2017-07-14 19:36:05 UTC) #98
Alexei Svitkine (slow)
It's pretty unfortunate that it only repros on a specific platform (10.9) - for which ...
3 years, 5 months ago (2017-07-14 19:40:03 UTC) #99
Robert Sesek
On 2017/07/14 19:40:03, Alexei Svitkine (slow) wrote: > It's pretty unfortunate that it only repros ...
3 years, 5 months ago (2017-07-14 19:46:02 UTC) #100
Alexei Svitkine (slow)
Okay, maybe file a crbug so that you don't forget. Thanks for looking into it! ...
3 years, 5 months ago (2017-07-14 19:50:12 UTC) #101
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2927593002/600001
3 years, 5 months ago (2017-07-14 20:20:43 UTC) #104
commit-bot: I haz the power
3 years, 5 months ago (2017-07-14 22:16:27 UTC) #107
Message was sent while issue was closed.
Committed patchset #27 (id:600001) as
https://chromium.googlesource.com/chromium/src/+/2d8b08c72cac89549268a67996c3...

Powered by Google App Engine
This is Rietveld 408576698