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_H_ | 5 #ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ |
6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ | 6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/time/time.h" | |
17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | |
16 #include "content/public/browser/profiler_subscriber.h" | 18 #include "content/public/browser/profiler_subscriber.h" |
17 | 19 |
18 // This class maintains state that is used to upload profiler data from the | 20 // This class maintains state that is used to upload profiler data from the |
19 // various processes, into the browser process. Such transactions are usually | 21 // various processes, into the browser process. Such transactions are usually |
20 // instigated by the browser. In general, a process will respond by gathering | 22 // instigated by the browser. In general, a process will respond by gathering |
21 // profiler data, and transmitting the pickled profiler data. We collect the | 23 // profiler data, and transmitting the pickled profiler data. We collect the |
22 // data in asynchronous mode that doesn't block the UI thread. | 24 // data in asynchronous mode that doesn't block the UI thread. |
23 // | 25 // |
24 // To assure that all the processes have responded, a counter is maintained | 26 // To assure that all the processes have responded, a counter is maintained |
25 // to indicate the number of pending (not yet responsive) processes. We tag | 27 // to indicate the number of pending (not yet responsive) processes. We tag |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 | 104 |
103 // We don't track the actual processes that are contacted for an update, only | 105 // We don't track the actual processes that are contacted for an update, only |
104 // the count of the number of processes, and we can sometimes time-out and | 106 // the count of the number of processes, and we can sometimes time-out and |
105 // give up on a "slow to respond" process. We use a sequence_number to be | 107 // give up on a "slow to respond" process. We use a sequence_number to be |
106 // sure a response from a process is associated with the current round of | 108 // sure a response from a process is associated with the current round of |
107 // requests. All sequence numbers used are non-negative. | 109 // requests. All sequence numbers used are non-negative. |
108 // last_used_sequence_number_ is the most recently used number (used to avoid | 110 // last_used_sequence_number_ is the most recently used number (used to avoid |
109 // reuse for a long time). | 111 // reuse for a long time). |
110 int last_used_sequence_number_; | 112 int last_used_sequence_number_; |
111 | 113 |
114 // Sequence of events associated with already completed profiling phases. The | |
115 // index in the vector is the phase number. The current phase is not included. | |
116 std::vector<ProfilerEventProto::ProfilerEvent> | |
Alexei Svitkine (slow)
2015/03/09 17:13:35
Don't you have a typedef for this in another file?
vadimt
2015/03/13 23:18:01
Yes. They are coincidentally same. I should be fre
| |
117 phase_completion_events_sequence_; | |
118 | |
119 // Time of the profiling start. Used to calculate times of phase change | |
120 // moments relative to this value. | |
121 const base::TimeTicks start_time_; | |
Ilya Sherman
2015/03/10 00:48:10
I think these two fields are only needed by the me
vadimt
2015/03/13 23:18:01
Can we get back to this once you see the not-yet i
Ilya Sherman
2015/03/14 00:02:31
Sure, we can come back to this. Please mark it so
vadimt
2015/03/14 01:39:15
Added a TODO note that I'll remove in the next CL,
| |
122 | |
123 // Times of starts of all profiling phases, including the current phase. The | |
124 // index in the vector is the phase number. | |
125 std::vector<base::TimeTicks> phase_start_times_; | |
Ilya Sherman
2015/03/10 00:48:10
I'd prefer to see the time deltas computed in //ba
vadimt
2015/03/13 23:18:01
We'll send one proto per phase. If each process pr
Ilya Sherman
2015/03/14 00:02:31
That suggests to me a flaw in our proto design, th
vadimt
2015/03/14 01:39:15
The alternative would be to send a proto per every
| |
126 | |
112 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizer); | 127 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizer); |
113 }; | 128 }; |
114 | 129 |
115 } // namespace metrics | 130 } // namespace metrics |
116 | 131 |
117 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ | 132 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ |
OLD | NEW |