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

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: address comments Created 5 years, 9 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
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 a2bb0f85a31bd8de9d0c53ad4d138ed1940aed4a..0cad6fd76fb30142506afa26ffc314b0bd4d2557 100644
--- a/components/metrics/call_stack_profile_metrics_provider.h
+++ b/components/metrics/call_stack_profile_metrics_provider.h
@@ -7,7 +7,10 @@
#include <vector>
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/profiler/stack_sampling_profiler.h"
+#include "base/synchronization/lock.h"
Ilya Sherman 2015/03/24 21:07:55 nit: No longer needed.
Mike Wittman 2015/03/24 22:40:59 Done.
#include "components/metrics/metrics_provider.h"
namespace metrics {
@@ -20,6 +23,8 @@ 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
@@ -28,8 +33,28 @@ class CallStackProfileMetricsProvider : public MetricsProvider {
void SetSourceProfilesForTesting(
const std::vector<base::StackSamplingProfiler::Profile>& profiles);
+ protected:
+ // Finch field trial and group for reporting profiles. Provided here for test
+ // use.
+ static const char kFieldTrialName[];
+ static const char kReportProfilesGroupName[];
Ilya Sherman 2015/03/24 21:07:55 Optional: Actually, an easier option for testing m
Mike Wittman 2015/03/24 22:40:59 Hmm, I'm not enthusiastic about the impact of that
+
private:
- std::vector<base::StackSamplingProfiler::Profile> 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,
Ilya Sherman 2015/03/24 21:07:55 nit: Forward-declare the MessageLoopProxy class?
Mike Wittman 2015/03/24 22:40:59 Done.
+ base::WeakPtr<CallStackProfileMetricsProvider> provider,
+ const std::vector<base::StackSamplingProfiler::Profile>& profiles);
+ void AppendCompletedProfiles(
+ const std::vector<base::StackSamplingProfiler::Profile>& profiles);
+
+ std::vector<base::StackSamplingProfiler::Profile> pending_profiles_;
+
+ base::WeakPtrFactory<CallStackProfileMetricsProvider> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider);
};

Powered by Google App Engine
This is Rietveld 408576698