Chromium Code Reviews| Index: chrome/browser/metrics/perf_provider_chromeos.h |
| diff --git a/chrome/browser/metrics/perf_provider_chromeos.h b/chrome/browser/metrics/perf_provider_chromeos.h |
| index 3bd0f467867821098f57d46ec3db82f149def38d..3f458e8bea34471263ebb05c103a26e7c7fb3ed2 100644 |
| --- a/chrome/browser/metrics/perf_provider_chromeos.h |
| +++ b/chrome/browser/metrics/perf_provider_chromeos.h |
| @@ -13,7 +13,7 @@ |
| #include "base/time/time.h" |
| #include "base/timer/timer.h" |
| #include "chromeos/login/login_state.h" |
| -#include "components/metrics/proto/perf_data.pb.h" |
| +#include "components/metrics/proto/sampled_profile.pb.h" |
| namespace metrics { |
| @@ -29,7 +29,7 @@ class PerfProvider : public base::NonThreadSafe { |
| // Writes collected perf data protobufs to |perf_data|. Clears all the stored |
| // perf data. Returns true if it wrote to |perf_data|. |
| - bool GetPerfData(std::vector<PerfDataProto>* perf_data); |
| + bool GetPerfData(std::vector<SampledProfile>* perf_data); |
|
Ilya Sherman
2014/05/29 22:56:49
Optional nit: Perhaps name this "GetSampledProfile
Simon Que
2014/05/30 01:21:45
Done.
|
| private: |
| // Class that listens for changes to the login state. When a normal user logs |
| @@ -57,26 +57,29 @@ class PerfProvider : public base::NonThreadSafe { |
| void Deactivate(); |
| // Starts an internal timer to start collecting perf data. The timer is set to |
| - // trigger |interval| after this function call. |
| - void ScheduleCollection(const base::TimeDelta& interval); |
| + // trigger at a random point in either the current or the next profiling |
| + // interval. |
|
Ilya Sherman
2014/05/29 22:56:49
nit: Please update this comment.
Simon Que
2014/05/30 01:21:45
Done.
|
| + void ScheduleCollection(); |
| // Collects perf data if it has not been consumed by calling GetPerfData() |
| // (see above). |
| - void CollectIfNecessary(); |
| + void CollectIfNecessary(SampledProfile::TriggerEvent trigger_event); |
|
Ilya Sherman
2014/05/29 22:56:49
nit: Please update the docs.
Simon Que
2014/05/30 01:21:45
Done.
|
| - // Collects perf data by calling CollectIfNecessary() and reschedules it to be |
| - // collected again. |
| - void CollectIfNecessaryAndReschedule(); |
| + // Collects perf data on a repeating basis by calling CollectIfNecessary() and |
| + // reschedules it to be collected again. |
| + void DoPeriodicCollection(); |
| - // Parses a protobuf from the |data| passed in only if the |
| + // Parses a perf data protobuf from the |data| passed in only if the |
| // |incognito_observer| indicates that no incognito window had been opened |
| // during the profile collection period. |
| + // |trigger_event| is the cause of the perf data collection. |
| void ParseProtoIfValid( |
| scoped_ptr<WindowedIncognitoObserver> incognito_observer, |
| + SampledProfile::TriggerEvent trigger_event, |
| const std::vector<uint8>& data); |
| - // Vector of perf data protobufs. |
| - std::vector<PerfDataProto> cached_perf_data_; |
| + // Vector of SampledProfile protobufs containing perf profiles. |
| + std::vector<SampledProfile> cached_perf_data_; |
| // For scheduling collection of perf data. |
| base::OneShotTimer<PerfProvider> timer_; |
| @@ -84,6 +87,12 @@ class PerfProvider : public base::NonThreadSafe { |
| // For detecting when changes to the login state. |
| LoginObserver login_observer_; |
| + // Record of the last login time. |
| + base::TimeTicks login_time_; |
| + |
| + // Record of the start of the upcoming profiling interval. |
| + base::TimeTicks next_profiling_interval_start_; |
| + |
| // To pass around the "this" pointer across threads safely. |
| base::WeakPtrFactory<PerfProvider> weak_factory_; |