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

Side by Side Diff: components/metrics/profiler/tracking_synchronizer_observer.h

Issue 1021053003: Delivering the FIRST_NONEMPTY_PAINT phase changing event to base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@phase_splitting
Patch Set: asvitkine@: more of. 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 unified diff | Download patch
OLDNEW
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> 8 #include <vector>
9 9
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
11 #include "base/time/time.h"
11 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" 12 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
12 #include "content/public/common/process_type.h" 13 #include "content/public/common/process_type.h"
13 14
14 namespace base { 15 namespace base {
15 class TimeDelta; 16 class TimeDelta;
16 } 17 }
17 18
18 namespace tracked_objects { 19 namespace tracked_objects {
19 struct ProcessDataPhaseSnapshot; 20 struct ProcessDataPhaseSnapshot;
20 } 21 }
21 22
22 namespace metrics { 23 namespace metrics {
23 24
24 // Set of profiling events, in no guaranteed order. Implemented as a vector 25 // Set of profiling events, in no guaranteed order. Implemented as a vector
25 // because we don't need to have an efficient .find() on it, so vector<> is more 26 // because we don't need to have an efficient .find() on it, so vector<> is more
26 // efficient. 27 // efficient.
27 typedef std::vector<ProfilerEventProto::ProfilerEvent> ProfilerEvents; 28 typedef std::vector<ProfilerEventProto::ProfilerEvent> ProfilerEvents;
28 29
29 // Observer for notifications from the TrackingSynchronizer class. 30 // Observer for notifications from the TrackingSynchronizer class.
30 class TrackingSynchronizerObserver { 31 class TrackingSynchronizerObserver {
31 public: 32 public:
32 // TODO(vadimt): Consider isherman@ idea: I'd change the phase_start and
33 // phase_finish from TimeDeltas to TimeTicks. And I'd omit the |past_events|
34 // list -- either in favor of a single ProfilerEvent that corresponds to the
35 // phase, or a method on the TrackingSynchronizer that can translate a
36 // profiling_phase to a ProfilerEvent.
37
38 // Received |process_data_phase| for profiling phase |profiling_phase| from a 33 // Received |process_data_phase| for profiling phase |profiling_phase| from a
39 // single process of |process_type|. The phase start and finish times, 34 // single process of |process_type|. The phase start and finish times are
40 // relative to the start time are |phase_start| and 35 // |phase_start| and |phase_finish|.
41 // |phase_finish|. All profiling phases prior to the reported one have already 36 // Each completed phase is associated with an event that triggered the
42 // completed, and each completion was associated with an instance of 37 // completion of the phase. |past_events| contains the set of events that
43 // ProfilerEventProto::ProfilerEvent. |past_events| contains events associated 38 // completed prior to the reported phase. This data structure is useful for
44 // with completions of phases prior to the reported one. 39 // quickly computing the full set of profiled traces that occurred before or
40 // after a given event.
45 // The observer should assume there might be more data coming until 41 // The observer should assume there might be more data coming until
46 // FinishedReceivingData() is called. 42 // FinishedReceivingData() is called.
47 virtual void ReceivedProfilerData( 43 virtual void ReceivedProfilerData(
48 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, 44 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase,
49 base::ProcessId process_id, 45 base::ProcessId process_id,
50 content::ProcessType process_type, 46 content::ProcessType process_type,
51 int profiling_phase, 47 int profiling_phase,
52 base::TimeDelta phase_start, 48 base::TimeTicks phase_start,
53 base::TimeDelta phase_finish, 49 base::TimeTicks phase_finish,
54 const ProfilerEvents& past_events) = 0; 50 const ProfilerEvents& past_events) = 0;
55 51
56 // The observer should not expect any more calls to |ReceivedProfilerData()| 52 // The observer should not expect any more calls to |ReceivedProfilerData()|
57 // (without re-registering). This is sent either when data from all processes 53 // (without re-registering). This is sent either when data from all processes
58 // has been gathered, or when the request times out. 54 // has been gathered, or when the request times out.
59 virtual void FinishedReceivingProfilerData() {} 55 virtual void FinishedReceivingProfilerData() {}
60 56
61 protected: 57 protected:
62 TrackingSynchronizerObserver() {} 58 TrackingSynchronizerObserver() {}
63 virtual ~TrackingSynchronizerObserver() {} 59 virtual ~TrackingSynchronizerObserver() {}
64 60
65 private: 61 private:
66 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver); 62 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver);
67 }; 63 };
68 64
69 } // namespace metrics 65 } // namespace metrics
70 66
71 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ 67 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698