| Index: chrome/browser/metrics/perf/perf_provider_chromeos.h
|
| diff --git a/chrome/browser/metrics/perf/perf_provider_chromeos.h b/chrome/browser/metrics/perf/perf_provider_chromeos.h
|
| index 64b28d2330bbfb3f354df5942c47c6652d3f50bb..0456516516be5d9ee48f1bbec96a3c9feb32d4ad 100644
|
| --- a/chrome/browser/metrics/perf/perf_provider_chromeos.h
|
| +++ b/chrome/browser/metrics/perf/perf_provider_chromeos.h
|
| @@ -35,6 +35,84 @@ class PerfProvider : public base::NonThreadSafe,
|
| bool GetSampledProfiles(std::vector<SampledProfile>* sampled_profiles);
|
|
|
| protected:
|
| + typedef int64_t TimeDeltaInternalType;
|
| +
|
| + class CollectionParams {
|
| + public:
|
| + class TriggerParams {
|
| + public:
|
| + TriggerParams(int64_t sampling_factor,
|
| + base::TimeDelta max_collection_delay);
|
| +
|
| + int64_t sampling_factor() const { return sampling_factor_; }
|
| + void set_sampling_factor(int64_t factor) { sampling_factor_ = factor; }
|
| +
|
| + base::TimeDelta max_collection_delay() const {
|
| + return base::TimeDelta::FromInternalValue(max_collection_delay_);
|
| + }
|
| + void set_max_collection_delay(base::TimeDelta delay) {
|
| + max_collection_delay_ = delay.ToInternalValue();
|
| + }
|
| +
|
| + private:
|
| + TriggerParams() = default; // POD
|
| +
|
| + // Limit the number of profiles collected.
|
| + int64_t sampling_factor_;
|
| +
|
| + // Add a random delay before collecting after the trigger.
|
| + // The delay should be randomly selected between 0 and this value.
|
| + TimeDeltaInternalType max_collection_delay_;
|
| + };
|
| +
|
| + CollectionParams(base::TimeDelta collection_duration,
|
| + base::TimeDelta periodic_interval,
|
| + TriggerParams resume_from_suspend,
|
| + TriggerParams restore_session);
|
| +
|
| + base::TimeDelta collection_duration() const {
|
| + return base::TimeDelta::FromInternalValue(collection_duration_);
|
| + }
|
| + void set_collection_duration(base::TimeDelta duration) {
|
| + collection_duration_ = duration.ToInternalValue();
|
| + }
|
| +
|
| + base::TimeDelta periodic_interval() const {
|
| + return base::TimeDelta::FromInternalValue(periodic_interval_);
|
| + }
|
| + void set_periodic_interval(base::TimeDelta interval) {
|
| + periodic_interval_ = interval.ToInternalValue();
|
| + }
|
| +
|
| + const TriggerParams& resume_from_suspend() const {
|
| + return resume_from_suspend_;
|
| + }
|
| + TriggerParams* mutable_resume_from_suspend() {
|
| + return &resume_from_suspend_;
|
| + }
|
| + const TriggerParams& restore_session() const {
|
| + return restore_session_;
|
| + }
|
| + TriggerParams* mutable_restore_session() {
|
| + return &restore_session_;
|
| + }
|
| +
|
| + private:
|
| + CollectionParams() = default; // POD
|
| +
|
| + // Time perf is run for.
|
| + TimeDeltaInternalType collection_duration_;
|
| +
|
| + // For PERIODIC_COLLECTION, partition time since login into successive
|
| + // intervals of this duration. In each interval, a random time is picked to
|
| + // collect a profile.
|
| + TimeDeltaInternalType periodic_interval_;
|
| +
|
| + // Parameters for RESUME_FROM_SUSPEND and RESTORE_SESSION collections:
|
| + TriggerParams resume_from_suspend_;
|
| + TriggerParams restore_session_;
|
| + };
|
| +
|
| // Parses a PerfDataProto from serialized data |perf_data|, if it exists.
|
| // Parses a PerfStatProto from serialized data |perf_stat|, if it exists.
|
| // Only one of these may contain data. If both |perf_data| and |perf_stat|
|
| @@ -53,6 +131,8 @@ class PerfProvider : public base::NonThreadSafe,
|
| const std::vector<uint8>& perf_stat);
|
|
|
| private:
|
| + static const CollectionParams kDefaultParameters;
|
| +
|
| // Class that listens for changes to the login state. When a normal user logs
|
| // in, it updates PerfProvider to start collecting data.
|
| class LoginObserver : public chromeos::LoginState::Observer {
|
| @@ -111,6 +191,9 @@ class PerfProvider : public base::NonThreadSafe,
|
| const base::TimeDelta& time_after_restore,
|
| int num_tabs_restored);
|
|
|
| + // Parameters controlling how profiles are collected.
|
| + CollectionParams collection_params_;
|
| +
|
| // Vector of SampledProfile protobufs containing perf profiles.
|
| std::vector<SampledProfile> cached_perf_data_;
|
|
|
|
|