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

Unified Diff: components/metrics/call_stack_profile_metrics_provider.h

Issue 1029653002: Enable startup profiling by Win x64 stack sampling profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@statprof-metrics-provider
Patch Set: add test Created 5 years, 8 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 | « chrome/browser/chrome_browser_main.cc ('k') | components/metrics/call_stack_profile_metrics_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/call_stack_profile_metrics_provider.h
diff --git a/components/metrics/call_stack_profile_metrics_provider.h b/components/metrics/call_stack_profile_metrics_provider.h
index 6d5ff8ccab362ead89d94c8ec8f62db03f8ff643..33f7f775622d049b1d23723885180509aa015c32 100644
--- a/components/metrics/call_stack_profile_metrics_provider.h
+++ b/components/metrics/call_stack_profile_metrics_provider.h
@@ -7,9 +7,15 @@
#include <vector>
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/profiler/stack_sampling_profiler.h"
#include "components/metrics/metrics_provider.h"
+namespace base {
+class MessageLoopProxy;
+} // namespace base
+
namespace metrics {
class ChromeUserMetricsExtension;
@@ -20,18 +26,38 @@ class CallStackProfileMetricsProvider : public MetricsProvider {
~CallStackProfileMetricsProvider() override;
// MetricsProvider:
+ void OnRecordingEnabled() override;
+ void OnRecordingDisabled() override;
void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override;
- // Uses |profiles| as the source data for the next invocation of
- // ProvideGeneralMetrics, rather than sourcing them from the
- // StackSamplingProfiler.
- void SetSourceProfilesForTesting(
+ // Appends |profiles| for use by the next invocation of ProvideGeneralMetrics,
+ // rather than sourcing them from the StackSamplingProfiler.
+ void AppendSourceProfilesForTesting(
const std::vector<base::StackSamplingProfiler::CallStackProfile>&
profiles);
+ protected:
+ // Finch field trial and group for reporting profiles. Provided here for test
+ // use.
+ static const char kFieldTrialName[];
+ static const char kReportProfilesGroupName[];
+
private:
- std::vector<base::StackSamplingProfiler::CallStackProfile>
- source_profiles_for_test_;
+ // Returns true if reporting of profiles is enabled according to the
+ // controlling Finch field trial.
+ static bool IsSamplingProfilingReportingEnabled();
+
+ // Invoked by the profiler on another thread.
+ static void ReceiveCompletedProfiles(
+ scoped_refptr<base::MessageLoopProxy> message_loop,
+ base::WeakPtr<CallStackProfileMetricsProvider> provider,
+ const base::StackSamplingProfiler::CallStackProfiles& profiles);
+ void AppendCompletedProfiles(
+ const base::StackSamplingProfiler::CallStackProfiles& profiles);
+
+ base::StackSamplingProfiler::CallStackProfiles pending_profiles_;
+
+ base::WeakPtrFactory<CallStackProfileMetricsProvider> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider);
};
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | components/metrics/call_stack_profile_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698