| Index: components/metrics/profiler/tracking_synchronizer_observer.h
|
| diff --git a/components/metrics/profiler/tracking_synchronizer_observer.h b/components/metrics/profiler/tracking_synchronizer_observer.h
|
| index 0e943508079bd814169fae18b759ff563f74c21f..c9f88a73d41a1a16d3d31b757d7bb754cb78b1cc 100644
|
| --- a/components/metrics/profiler/tracking_synchronizer_observer.h
|
| +++ b/components/metrics/profiler/tracking_synchronizer_observer.h
|
| @@ -8,6 +8,7 @@
|
| #include <vector>
|
|
|
| #include "base/process/process_handle.h"
|
| +#include "base/time/time.h"
|
| #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
|
| #include "content/public/common/process_type.h"
|
|
|
| @@ -26,31 +27,46 @@ namespace metrics {
|
| // efficient.
|
| typedef std::vector<ProfilerEventProto::ProfilerEvent> ProfilerEvents;
|
|
|
| +// Attributes of profiler data passed to
|
| +// TrackingSynchronizerObserver::ReceivedProfilerData.
|
| +struct ProfilerDataAttributes {
|
| + ProfilerDataAttributes(int profiling_phase,
|
| + base::ProcessId process_id,
|
| + content::ProcessType process_type,
|
| + base::TimeTicks phase_start,
|
| + base::TimeTicks phase_finish);
|
| +
|
| + // 0-indexed profiling phase number.
|
| + const int profiling_phase;
|
| +
|
| + // ID of the process that reported the data.
|
| + const base::ProcessId process_id;
|
| +
|
| + // Type of the process that reported the data.
|
| + const content::ProcessType process_type;
|
| +
|
| + // Time of the profiling phase start.
|
| + const base::TimeTicks phase_start;
|
| +
|
| + // Time of the profiling phase finish.
|
| + const base::TimeTicks phase_finish;
|
| +};
|
| +
|
| // Observer for notifications from the TrackingSynchronizer class.
|
| class TrackingSynchronizerObserver {
|
| public:
|
| - // TODO(vadimt): Consider isherman@ idea: I'd change the phase_start and
|
| - // phase_finish from TimeDeltas to TimeTicks. And I'd omit the |past_events|
|
| - // list -- either in favor of a single ProfilerEvent that corresponds to the
|
| - // phase, or a method on the TrackingSynchronizer that can translate a
|
| - // profiling_phase to a ProfilerEvent.
|
| -
|
| - // Received |process_data_phase| for profiling phase |profiling_phase| from a
|
| - // single process of |process_type|. The phase start and finish times,
|
| - // relative to the start time are |phase_start| and
|
| - // |phase_finish|. All profiling phases prior to the reported one have already
|
| - // completed, and each completion was associated with an instance of
|
| - // ProfilerEventProto::ProfilerEvent. |past_events| contains events associated
|
| - // with completions of phases prior to the reported one.
|
| + // Received |process_data_phase| for profiling phase and process defined by
|
| + // |attributes|.
|
| + // Each completed phase is associated with an event that triggered the
|
| + // completion of the phase. |past_events| contains the set of events that
|
| + // completed prior to the reported phase. This data structure is useful for
|
| + // quickly computing the full set of profiled traces that occurred before or
|
| + // after a given event.
|
| // The observer should assume there might be more data coming until
|
| // FinishedReceivingData() is called.
|
| virtual void ReceivedProfilerData(
|
| + const ProfilerDataAttributes& attributes,
|
| const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase,
|
| - base::ProcessId process_id,
|
| - content::ProcessType process_type,
|
| - int profiling_phase,
|
| - base::TimeDelta phase_start,
|
| - base::TimeDelta phase_finish,
|
| const ProfilerEvents& past_events) = 0;
|
|
|
| // The observer should not expect any more calls to |ReceivedProfilerData()|
|
|
|