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

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

Issue 112863002: Merge bleeding_edge 18021:18297 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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
« no previous file with comments | « src/heap-inl.h ('k') | src/heap-profiler.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-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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_HEAP_PROFILER_H_ 28 #ifndef V8_HEAP_PROFILER_H_
29 #define V8_HEAP_PROFILER_H_ 29 #define V8_HEAP_PROFILER_H_
30 30
31 #include "heap-snapshot-generator-inl.h" 31 #include "heap-snapshot-generator-inl.h"
32 #include "isolate.h" 32 #include "isolate.h"
33 #include "smart-pointers.h"
33 34
34 namespace v8 { 35 namespace v8 {
35 namespace internal { 36 namespace internal {
36 37
37 class HeapSnapshot; 38 class HeapSnapshot;
38 class HeapSnapshotsCollection;
39 39
40 class HeapProfiler { 40 class HeapProfiler {
41 public: 41 public:
42 explicit HeapProfiler(Heap* heap); 42 explicit HeapProfiler(Heap* heap);
43 ~HeapProfiler(); 43 ~HeapProfiler();
44 44
45 size_t GetMemorySizeUsedByProfiler(); 45 size_t GetMemorySizeUsedByProfiler();
46 46
47 HeapSnapshot* TakeSnapshot( 47 HeapSnapshot* TakeSnapshot(
48 const char* name, 48 const char* name,
49 v8::ActivityControl* control, 49 v8::ActivityControl* control,
50 v8::HeapProfiler::ObjectNameResolver* resolver); 50 v8::HeapProfiler::ObjectNameResolver* resolver);
51 HeapSnapshot* TakeSnapshot( 51 HeapSnapshot* TakeSnapshot(
52 String* name, 52 String* name,
53 v8::ActivityControl* control, 53 v8::ActivityControl* control,
54 v8::HeapProfiler::ObjectNameResolver* resolver); 54 v8::HeapProfiler::ObjectNameResolver* resolver);
55 55
56 void StartHeapObjectsTracking(); 56 void StartHeapObjectsTracking(bool track_allocations);
57 void StopHeapObjectsTracking(); 57 void StopHeapObjectsTracking();
58 AllocationTracker* allocation_tracker() const {
59 return allocation_tracker_.get();
60 }
61 HeapObjectsMap* heap_object_map() const { return ids_.get(); }
62 StringsStorage* names() const { return names_.get(); }
58 63
59 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); 64 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
60 int GetSnapshotsCount(); 65 int GetSnapshotsCount();
61 HeapSnapshot* GetSnapshot(int index); 66 HeapSnapshot* GetSnapshot(int index);
62 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); 67 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
63 void DeleteAllSnapshots(); 68 void DeleteAllSnapshots();
69 void RemoveSnapshot(HeapSnapshot* snapshot);
64 70
65 void ObjectMoveEvent(Address from, Address to, int size); 71 void ObjectMoveEvent(Address from, Address to, int size);
66 72
67 void NewObjectEvent(Address addr, int size); 73 void AllocationEvent(Address addr, int size);
68 74
69 void UpdateObjectSizeEvent(Address addr, int size); 75 void UpdateObjectSizeEvent(Address addr, int size);
70 76
71 void DefineWrapperClass( 77 void DefineWrapperClass(
72 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); 78 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
73 79
74 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, 80 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
75 Object** wrapper); 81 Object** wrapper);
76 INLINE(bool is_profiling()) { 82 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
77 return snapshots_->is_tracking_objects(); 83
84 bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
85 bool is_tracking_allocations() const {
86 return !allocation_tracker_.is_empty();
78 } 87 }
79 88
80 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); 89 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
81
82 bool is_tracking_allocations() {
83 return is_tracking_allocations_;
84 }
85
86 void StartHeapAllocationsRecording();
87 void StopHeapAllocationsRecording();
88
89 int FindUntrackedObjects() {
90 return snapshots_->FindUntrackedObjects();
91 }
92 90
93 private: 91 private:
94 Heap* heap() const { return snapshots_->heap(); } 92 Heap* heap() const { return ids_->heap(); }
95 93
96 HeapSnapshotsCollection* snapshots_; 94 // Mapping from HeapObject addresses to objects' uids.
95 SmartPointer<HeapObjectsMap> ids_;
96 List<HeapSnapshot*> snapshots_;
97 SmartPointer<StringsStorage> names_;
97 unsigned next_snapshot_uid_; 98 unsigned next_snapshot_uid_;
98 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; 99 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
99 bool is_tracking_allocations_; 100 SmartPointer<AllocationTracker> allocation_tracker_;
101 bool is_tracking_object_moves_;
100 }; 102 };
101 103
102 } } // namespace v8::internal 104 } } // namespace v8::internal
103 105
104 #endif // V8_HEAP_PROFILER_H_ 106 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698