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: src/heap-profiler.cc

Issue 3020002: Heap profiler: implement diffing of snapshots. (Closed)
Patch Set: Comments addressed Created 10 years, 5 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
« no previous file with comments | « src/heap-profiler.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 ASSERT(singleton_ != NULL); 357 ASSERT(singleton_ != NULL);
358 return singleton_->TakeSnapshotImpl(name); 358 return singleton_->TakeSnapshotImpl(name);
359 } 359 }
360 360
361 361
362 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name) { 362 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name) {
363 Heap::CollectAllGarbage(false); 363 Heap::CollectAllGarbage(false);
364 HeapSnapshot* result = snapshots_->NewSnapshot(name, next_snapshot_uid_++); 364 HeapSnapshot* result = snapshots_->NewSnapshot(name, next_snapshot_uid_++);
365 HeapSnapshotGenerator generator(result); 365 HeapSnapshotGenerator generator(result);
366 generator.GenerateSnapshot(); 366 generator.GenerateSnapshot();
367 snapshots_->SnapshotGenerationFinished();
367 return result; 368 return result;
368 } 369 }
369 370
370 371
371 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(String* name) { 372 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(String* name) {
372 return TakeSnapshotImpl(snapshots_->GetName(name)); 373 return TakeSnapshotImpl(snapshots_->GetName(name));
373 } 374 }
374 375
375 376
376 int HeapProfiler::GetSnapshotsCount() { 377 int HeapProfiler::GetSnapshotsCount() {
377 ASSERT(singleton_ != NULL); 378 ASSERT(singleton_ != NULL);
378 return singleton_->snapshots_->snapshots()->length(); 379 return singleton_->snapshots_->snapshots()->length();
379 } 380 }
380 381
381 382
382 HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 383 HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
383 ASSERT(singleton_ != NULL); 384 ASSERT(singleton_ != NULL);
384 return singleton_->snapshots_->snapshots()->at(index); 385 return singleton_->snapshots_->snapshots()->at(index);
385 } 386 }
386 387
387 388
388 HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { 389 HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
389 ASSERT(singleton_ != NULL); 390 ASSERT(singleton_ != NULL);
390 return singleton_->snapshots_->GetSnapshot(uid); 391 return singleton_->snapshots_->GetSnapshot(uid);
391 } 392 }
392 393
393 394
395 void HeapProfiler::ObjectMoveEvent(Address from, Address to) {
396 ASSERT(singleton_ != NULL);
397 singleton_->snapshots_->ObjectMoveEvent(from, to);
398 }
399
400
394 const JSObjectsClusterTreeConfig::Key JSObjectsClusterTreeConfig::kNoKey; 401 const JSObjectsClusterTreeConfig::Key JSObjectsClusterTreeConfig::kNoKey;
395 const JSObjectsClusterTreeConfig::Value JSObjectsClusterTreeConfig::kNoValue; 402 const JSObjectsClusterTreeConfig::Value JSObjectsClusterTreeConfig::kNoValue;
396 403
397 404
398 ConstructorHeapProfile::ConstructorHeapProfile() 405 ConstructorHeapProfile::ConstructorHeapProfile()
399 : zscope_(DELETE_ON_EXIT) { 406 : zscope_(DELETE_ON_EXIT) {
400 } 407 }
401 408
402 409
403 void ConstructorHeapProfile::Call(const JSObjectsCluster& cluster, 410 void ConstructorHeapProfile::Call(const JSObjectsCluster& cluster,
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 GlobalHandles::MakeWeak(handle.location(), 770 GlobalHandles::MakeWeak(handle.location(),
764 static_cast<void*>(stack.start()), 771 static_cast<void*>(stack.start()),
765 StackWeakReferenceCallback); 772 StackWeakReferenceCallback);
766 } 773 }
767 774
768 775
769 #endif // ENABLE_LOGGING_AND_PROFILING 776 #endif // ENABLE_LOGGING_AND_PROFILING
770 777
771 778
772 } } // namespace v8::internal 779 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-profiler.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698