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 #include "base/tracked_objects.h" | 5 #include "base/tracked_objects.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // but that should be inconsequentially likely). We ignore the fact that we | 167 // but that should be inconsequentially likely). We ignore the fact that we |
168 // correlated our selection of a sample to the run and queue times (i.e., we | 168 // correlated our selection of a sample to the run and queue times (i.e., we |
169 // used them to generate random_number). | 169 // used them to generate random_number). |
170 CHECK_GT(sample_probability_count, 0); | 170 CHECK_GT(sample_probability_count, 0); |
171 if (0 == (random_number % sample_probability_count)) { | 171 if (0 == (random_number % sample_probability_count)) { |
172 queue_duration_sample_ = queue_duration; | 172 queue_duration_sample_ = queue_duration; |
173 run_duration_sample_ = run_duration; | 173 run_duration_sample_ = run_duration; |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 int DeathData::count() const { return count_; } | |
178 | |
179 int32 DeathData::run_duration_sum() const { return run_duration_sum_; } | |
180 | |
181 int32 DeathData::run_duration_max() const { return run_duration_max_; } | |
182 | |
183 int32 DeathData::run_duration_sample() const { | |
184 return run_duration_sample_; | |
185 } | |
186 | |
187 int32 DeathData::queue_duration_sum() const { | |
188 return queue_duration_sum_; | |
189 } | |
190 | |
191 int32 DeathData::queue_duration_max() const { | |
192 return queue_duration_max_; | |
193 } | |
194 | |
195 int32 DeathData::queue_duration_sample() const { | |
196 return queue_duration_sample_; | |
197 } | |
198 | |
199 const DeathDataPhaseSnapshot* DeathData::last_phase_snapshot() const { | |
200 return last_phase_snapshot_; | |
201 } | |
202 | |
203 void DeathData::OnProfilingPhaseCompleted(int profiling_phase) { | 177 void DeathData::OnProfilingPhaseCompleted(int profiling_phase) { |
204 // Snapshotting and storing current state. | 178 // Snapshotting and storing current state. |
205 last_phase_snapshot_ = new DeathDataPhaseSnapshot( | 179 last_phase_snapshot_ = new DeathDataPhaseSnapshot( |
206 profiling_phase, count_, run_duration_sum_, run_duration_max_, | 180 profiling_phase, count_, run_duration_sum_, run_duration_max_, |
207 run_duration_sample_, queue_duration_sum_, queue_duration_max_, | 181 run_duration_sample_, queue_duration_sum_, queue_duration_max_, |
208 queue_duration_sample_, last_phase_snapshot_); | 182 queue_duration_sample_, last_phase_snapshot_); |
209 | 183 |
210 // Not touching fields for which a delta can be computed by comparing with a | 184 // Not touching fields for which a delta can be computed by comparing with a |
211 // snapshot from the previous phase. Resetting other fields. Sample values | 185 // snapshot from the previous phase. Resetting other fields. Sample values |
212 // will be reset upon next death recording because sample_probability_count_ | 186 // will be reset upon next death recording because sample_probability_count_ |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 : process_id(base::GetCurrentProcId()) { | 1068 : process_id(base::GetCurrentProcId()) { |
1095 #else | 1069 #else |
1096 : process_id(base::kNullProcessId) { | 1070 : process_id(base::kNullProcessId) { |
1097 #endif | 1071 #endif |
1098 } | 1072 } |
1099 | 1073 |
1100 ProcessDataSnapshot::~ProcessDataSnapshot() { | 1074 ProcessDataSnapshot::~ProcessDataSnapshot() { |
1101 } | 1075 } |
1102 | 1076 |
1103 } // namespace tracked_objects | 1077 } // namespace tracked_objects |
OLD | NEW |