Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ | 5 #ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ |
| 6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ | 6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 10 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class TimeDelta; | |
| 14 } | |
| 15 | |
| 8 namespace tracked_objects { | 16 namespace tracked_objects { |
| 9 struct ProcessDataSnapshot; | 17 struct ProcessDataPhaseSnapshot; |
| 10 } | 18 } |
| 11 | 19 |
| 12 namespace metrics { | 20 namespace metrics { |
| 13 | 21 |
| 22 // Set of profiling events, in no guaranteed order. | |
|
Alexei Svitkine (slow)
2015/03/09 17:13:35
It's confusing to have something named a set when
Ilya Sherman
2015/03/10 00:48:11
Or, just call this a "list".
Ilya Sherman
2015/03/10 00:48:11
Why isn't the order guaranteed?
vadimt
2015/03/13 23:18:01
The server doesn't use order. Hence, the client ha
vadimt
2015/03/13 23:18:01
Done.
| |
| 23 typedef std::vector<ProfilerEventProto::ProfilerEvent> ProfilerEventsSet; | |
|
Ilya Sherman
2015/03/10 00:48:11
Definitely please don't name the type "set" if it'
vadimt
2015/03/13 23:18:02
Done.
| |
| 24 | |
| 14 // Observer for notifications from the TrackingSynchronizer class. | 25 // Observer for notifications from the TrackingSynchronizer class. |
| 15 class TrackingSynchronizerObserver { | 26 class TrackingSynchronizerObserver { |
| 16 public: | 27 public: |
| 17 // Received |profiler_data| from a single process of |process_type|. | 28 // Received |process_data_phase| for profiling phase |profiling_phase| from a |
| 29 // single process of |process_type|. The phase start and finish times, | |
| 30 // relative to the start time are |profiling_phase_start| and | |
| 31 // |profiling_phase_finish|. |past_profiler_events| is the set of events that | |
| 32 // caused finishing prior profiling phases. | |
|
Ilya Sherman
2015/03/10 00:48:11
nit: This final sentence is not very clear. Pleas
vadimt
2015/03/13 23:18:02
Done.
| |
| 18 // The observer should assume there might be more data coming until | 33 // The observer should assume there might be more data coming until |
| 19 // |FinishedReceivingData()| is called. | 34 // |FinishedReceivingData()| is called. |
| 20 virtual void ReceivedProfilerData( | 35 virtual void ReceivedProfilerData( |
| 21 const tracked_objects::ProcessDataSnapshot& profiler_data, | 36 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, |
|
Alexei Svitkine (slow)
2015/03/09 17:13:35
This is now a lot of parameters. How about definin
Ilya Sherman
2015/03/10 00:48:11
In particular, why aren't these all members of Pro
vadimt
2015/03/13 23:18:02
Because they are calculated in TrackingSynchronize
vadimt
2015/03/13 23:18:02
I don't feel very good about creating a copy of Pr
Ilya Sherman
2015/03/14 00:02:31
(a) I'd prefer to track all of this in //base, so
vadimt
2015/03/14 01:39:15
Can do, but first please confirm that you are OK w
| |
| 22 int process_type) = 0; | 37 int process_id, |
|
Alexei Svitkine (slow)
2015/03/09 17:13:35
Is there a reason this is an int and not a base::P
vadimt
2015/03/13 23:18:02
Done.
| |
| 38 int process_type, | |
|
Alexei Svitkine (slow)
2015/03/09 17:13:35
Again, shouldn't this be some enum type?
vadimt
2015/03/13 23:18:02
Done, but I'd rather revert it since Nacl passes v
| |
| 39 int profiling_phase, | |
|
Alexei Svitkine (slow)
2015/03/09 17:13:35
Likewise - if this file is depending on the protob
vadimt
2015/03/13 23:18:01
No, this is just a number of the profiling phase.
| |
| 40 const base::TimeDelta& profiling_phase_start, | |
| 41 const base::TimeDelta& profiling_phase_finish, | |
| 42 const ProfilerEventsSet& past_profiler_events) = 0; | |
| 23 | 43 |
| 24 // The observer should not expect any more calls to |ReceivedProfilerData()| | 44 // The observer should not expect any more calls to |ReceivedProfilerData()| |
| 25 // (without re-registering). This is sent either when data from all processes | 45 // (without re-registering). This is sent either when data from all processes |
| 26 // has been gathered, or when the request times out. | 46 // has been gathered, or when the request times out. |
| 27 virtual void FinishedReceivingProfilerData() {} | 47 virtual void FinishedReceivingProfilerData() {} |
| 28 | 48 |
| 29 protected: | 49 protected: |
| 30 TrackingSynchronizerObserver() {} | 50 TrackingSynchronizerObserver() {} |
| 31 virtual ~TrackingSynchronizerObserver() {} | 51 virtual ~TrackingSynchronizerObserver() {} |
| 32 | 52 |
| 33 private: | 53 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver); | 54 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver); |
| 35 }; | 55 }; |
| 36 | 56 |
| 37 } // namespace metrics | 57 } // namespace metrics |
| 38 | 58 |
| 39 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ | 59 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ |
| OLD | NEW |