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

Side by Side Diff: third_party/tcmalloc/chromium/src/deep-heap-profile.cc

Issue 14823009: Add the reason in heap profiler dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 7 years, 7 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 // --- 5 // ---
6 // Author: Sainbayar Sukhbaatar 6 // Author: Sainbayar Sukhbaatar
7 // Dai Mikurube 7 // Dai Mikurube
8 // 8 //
9 9
10 #include "deep-heap-profile.h" 10 #include "deep-heap-profile.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 DeepHeapProfile::~DeepHeapProfile() { 224 DeepHeapProfile::~DeepHeapProfile() {
225 heap_profile_->dealloc_(profiler_buffer_); 225 heap_profile_->dealloc_(profiler_buffer_);
226 heap_profile_->dealloc_(filename_prefix_); 226 heap_profile_->dealloc_(filename_prefix_);
227 delete memory_residence_info_getter_; 227 delete memory_residence_info_getter_;
228 } 228 }
229 229
230 // Global malloc() should not be used in this function. 230 // Global malloc() should not be used in this function.
231 // Use LowLevelAlloc if required. 231 // Use LowLevelAlloc if required.
232 int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) { 232 int DeepHeapProfile::FillOrderedProfile(char raw_buffer[],
233 int buffer_size,
234 const char* reason) {
233 TextBuffer buffer(raw_buffer, buffer_size); 235 TextBuffer buffer(raw_buffer, buffer_size);
234 TextBuffer global_buffer(profiler_buffer_, kProfilerBufferSize); 236 TextBuffer global_buffer(profiler_buffer_, kProfilerBufferSize);
235 237
236 #ifndef NDEBUG 238 #ifndef NDEBUG
237 int64 starting_cycles = CycleClock::Now(); 239 int64 starting_cycles = CycleClock::Now();
238 #endif 240 #endif
239 241
240 // Get the time before starting snapshot. 242 // Get the time before starting snapshot.
241 // TODO(dmikurube): Consider gettimeofday if available. 243 // TODO(dmikurube): Consider gettimeofday if available.
242 time_t time_value = time(NULL); 244 time_t time_value = time(NULL);
(...skipping 25 matching lines...) Expand all
268 buffer.AppendString(kProfileVersion, 0); 270 buffer.AppendString(kProfileVersion, 0);
269 buffer.AppendString("\n", 0); 271 buffer.AppendString("\n", 0);
270 272
271 // Fill buffer with meta information. 273 // Fill buffer with meta information.
272 buffer.AppendString(kMetaInformationHeader, 0); 274 buffer.AppendString(kMetaInformationHeader, 0);
273 275
274 buffer.AppendString("Time: ", 0); 276 buffer.AppendString("Time: ", 0);
275 buffer.AppendUnsignedLong(time_value, 0); 277 buffer.AppendUnsignedLong(time_value, 0);
276 buffer.AppendChar('\n'); 278 buffer.AppendChar('\n');
277 279
280 if (reason != NULL) {
281 buffer.AppendString("Reason: ", 0);
282 buffer.AppendString(reason, 0);
283 buffer.AppendChar('\n');
284 }
285
278 // Fill buffer with the global stats. 286 // Fill buffer with the global stats.
279 buffer.AppendString(kMMapListHeader, 0); 287 buffer.AppendString(kMMapListHeader, 0);
280 288
281 stats_.SnapshotMaps(memory_residence_info_getter_, this, &buffer); 289 stats_.SnapshotMaps(memory_residence_info_getter_, this, &buffer);
282 290
283 // Fill buffer with the global stats. 291 // Fill buffer with the global stats.
284 buffer.AppendString(kGlobalStatsHeader, 0); 292 buffer.AppendString(kGlobalStatsHeader, 0);
285 293
286 stats_.Unparse(&buffer); 294 stats_.Unparse(&buffer);
287 295
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 966 }
959 967
960 DeepHeapProfile::~DeepHeapProfile() { 968 DeepHeapProfile::~DeepHeapProfile() {
961 } 969 }
962 970
963 int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) { 971 int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) {
964 return heap_profile_->FillOrderedProfile(raw_buffer, buffer_size); 972 return heap_profile_->FillOrderedProfile(raw_buffer, buffer_size);
965 } 973 }
966 974
967 #endif // USE_DEEP_HEAP_PROFILE 975 #endif // USE_DEEP_HEAP_PROFILE
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698