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

Side by Side Diff: src/heap-profiler.cc

Issue 6685084: Add support for CPU and heap profiles deletion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implemente per-profile deletion Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 HeapProfiler::HeapProfiler() 319 HeapProfiler::HeapProfiler()
320 : snapshots_(new HeapSnapshotsCollection()), 320 : snapshots_(new HeapSnapshotsCollection()),
321 next_snapshot_uid_(1) { 321 next_snapshot_uid_(1) {
322 } 322 }
323 323
324 324
325 HeapProfiler::~HeapProfiler() { 325 HeapProfiler::~HeapProfiler() {
326 delete snapshots_; 326 delete snapshots_;
327 } 327 }
328 328
329
330 void HeapProfiler::ResetSnapshots() {
331 delete snapshots_;
332 snapshots_ = new HeapSnapshotsCollection();
333 }
334
335
329 #endif // ENABLE_LOGGING_AND_PROFILING 336 #endif // ENABLE_LOGGING_AND_PROFILING
330 337
331 void HeapProfiler::Setup() { 338 void HeapProfiler::Setup() {
332 #ifdef ENABLE_LOGGING_AND_PROFILING 339 #ifdef ENABLE_LOGGING_AND_PROFILING
333 Isolate* isolate = Isolate::Current(); 340 Isolate* isolate = Isolate::Current();
334 if (isolate->heap_profiler() == NULL) { 341 if (isolate->heap_profiler() == NULL) {
335 isolate->set_heap_profiler(new HeapProfiler()); 342 isolate->set_heap_profiler(new HeapProfiler());
336 } 343 }
337 #endif 344 #endif
338 } 345 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 450 }
444 451
445 452
446 HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { 453 HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
447 HeapProfiler* profiler = Isolate::Current()->heap_profiler(); 454 HeapProfiler* profiler = Isolate::Current()->heap_profiler();
448 ASSERT(profiler != NULL); 455 ASSERT(profiler != NULL);
449 return profiler->snapshots_->GetSnapshot(uid); 456 return profiler->snapshots_->GetSnapshot(uid);
450 } 457 }
451 458
452 459
460 void HeapProfiler::DeleteAllSnapshots() {
461 HeapProfiler* profiler = Isolate::Current()->heap_profiler();
462 ASSERT(profiler != NULL);
463 profiler->ResetSnapshots();
464 }
465
466
453 void HeapProfiler::ObjectMoveEvent(Address from, Address to) { 467 void HeapProfiler::ObjectMoveEvent(Address from, Address to) {
454 snapshots_->ObjectMoveEvent(from, to); 468 snapshots_->ObjectMoveEvent(from, to);
455 } 469 }
456 470
457 471
458 const JSObjectsClusterTreeConfig::Key JSObjectsClusterTreeConfig::kNoKey; 472 const JSObjectsClusterTreeConfig::Key JSObjectsClusterTreeConfig::kNoKey;
459 const JSObjectsClusterTreeConfig::Value JSObjectsClusterTreeConfig::kNoValue; 473 const JSObjectsClusterTreeConfig::Value JSObjectsClusterTreeConfig::kNoValue;
460 474
461 475
462 ConstructorHeapProfile::ConstructorHeapProfile() 476 ConstructorHeapProfile::ConstructorHeapProfile()
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 isolate_->global_handles()->MakeWeak(handle.location(), 1164 isolate_->global_handles()->MakeWeak(handle.location(),
1151 static_cast<void*>(stack.start()), 1165 static_cast<void*>(stack.start()),
1152 StackWeakReferenceCallback); 1166 StackWeakReferenceCallback);
1153 } 1167 }
1154 1168
1155 1169
1156 #endif // ENABLE_LOGGING_AND_PROFILING 1170 #endif // ENABLE_LOGGING_AND_PROFILING
1157 1171
1158 1172
1159 } } // namespace v8::internal 1173 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698