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

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

Issue 985773002: Introducing phased profiling framework (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@write_to_file
Patch Set: Additional isherman@ 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 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>
9
10 #include "base/process/process_handle.h"
11 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
12 #include "content/public/common/process_type.h"
13
14 namespace base {
15 class TimeDelta;
16 }
17
8 namespace tracked_objects { 18 namespace tracked_objects {
9 struct ProcessDataSnapshot; 19 struct ProcessDataPhaseSnapshot;
10 } 20 }
11 21
12 namespace metrics { 22 namespace metrics {
13 23
24 // 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 // efficient.
27 typedef std::vector<ProfilerEventProto::ProfilerEvent> ProfilerEvents;
28
14 // Observer for notifications from the TrackingSynchronizer class. 29 // Observer for notifications from the TrackingSynchronizer class.
15 class TrackingSynchronizerObserver { 30 class TrackingSynchronizerObserver {
16 public: 31 public:
17 // Received |profiler_data| from a single process of |process_type|. 32 // Received |process_data_phase| for profiling phase |profiling_phase| from a
33 // single process of |process_type|. The phase start and finish times,
34 // relative to the start time are |phase_start| and
35 // |phase_finish|. All profiling phases prior to the reported one have already
36 // completed, and each completion was associated with an instance of
37 // ProfilerEventProto::ProfilerEvent. |past_events| contains events associated
38 // with completions of phases prior to the reported one.
18 // The observer should assume there might be more data coming until 39 // The observer should assume there might be more data coming until
19 // |FinishedReceivingData()| is called. 40 // FinishedReceivingData() is called.
20 virtual void ReceivedProfilerData( 41 virtual void ReceivedProfilerData(
21 const tracked_objects::ProcessDataSnapshot& profiler_data, 42 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase,
22 int process_type) = 0; 43 base::ProcessId process_id,
44 content::ProcessType process_type,
45 int profiling_phase,
46 const base::TimeDelta& phase_start,
47 const base::TimeDelta& phase_finish,
48 const ProfilerEvents& past_events) = 0;
23 49
24 // The observer should not expect any more calls to |ReceivedProfilerData()| 50 // The observer should not expect any more calls to |ReceivedProfilerData()|
25 // (without re-registering). This is sent either when data from all processes 51 // (without re-registering). This is sent either when data from all processes
26 // has been gathered, or when the request times out. 52 // has been gathered, or when the request times out.
27 virtual void FinishedReceivingProfilerData() {} 53 virtual void FinishedReceivingProfilerData() {}
28 54
29 protected: 55 protected:
30 TrackingSynchronizerObserver() {} 56 TrackingSynchronizerObserver() {}
31 virtual ~TrackingSynchronizerObserver() {} 57 virtual ~TrackingSynchronizerObserver() {}
32 58
33 private: 59 private:
34 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver); 60 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver);
35 }; 61 };
36 62
37 } // namespace metrics 63 } // namespace metrics
38 64
39 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ 65 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698