OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } \ | 44 } \ |
45 } while (false) | 45 } while (false) |
46 | 46 |
47 class HeapProfiler { | 47 class HeapProfiler { |
48 public: | 48 public: |
49 static void SetUp(); | 49 static void SetUp(); |
50 static void TearDown(); | 50 static void TearDown(); |
51 | 51 |
52 static size_t GetMemorySizeUsedByProfiler(); | 52 static size_t GetMemorySizeUsedByProfiler(); |
53 | 53 |
54 static HeapSnapshot* TakeSnapshot(const char* name, | 54 static HeapSnapshot* TakeSnapshot( |
55 int type, | 55 const char* name, |
56 v8::ActivityControl* control); | 56 int type, |
57 static HeapSnapshot* TakeSnapshot(String* name, | 57 v8::ActivityControl* control, |
58 int type, | 58 v8::HeapProfiler::ObjectNameResolver* resolver); |
59 v8::ActivityControl* control); | 59 static HeapSnapshot* TakeSnapshot( |
| 60 String* name, |
| 61 int type, |
| 62 v8::ActivityControl* control, |
| 63 v8::HeapProfiler::ObjectNameResolver* resolver); |
60 | 64 |
61 static void StartHeapObjectsTracking(); | 65 static void StartHeapObjectsTracking(); |
62 static void StopHeapObjectsTracking(); | 66 static void StopHeapObjectsTracking(); |
63 static SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); | 67 static SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); |
64 static int GetSnapshotsCount(); | 68 static int GetSnapshotsCount(); |
65 static HeapSnapshot* GetSnapshot(int index); | 69 static HeapSnapshot* GetSnapshot(int index); |
66 static HeapSnapshot* FindSnapshot(unsigned uid); | 70 static HeapSnapshot* FindSnapshot(unsigned uid); |
67 static SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); | 71 static SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); |
68 static void DeleteAllSnapshots(); | 72 static void DeleteAllSnapshots(); |
69 | 73 |
70 void ObjectMoveEvent(Address from, Address to); | 74 void ObjectMoveEvent(Address from, Address to); |
71 | 75 |
72 void DefineWrapperClass( | 76 void DefineWrapperClass( |
73 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); | 77 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); |
74 | 78 |
75 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, | 79 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, |
76 Object** wrapper); | 80 Object** wrapper); |
77 INLINE(bool is_profiling()) { | 81 INLINE(bool is_profiling()) { |
78 return snapshots_->is_tracking_objects(); | 82 return snapshots_->is_tracking_objects(); |
79 } | 83 } |
80 | 84 |
81 private: | 85 private: |
82 HeapProfiler(); | 86 HeapProfiler(); |
83 ~HeapProfiler(); | 87 ~HeapProfiler(); |
84 HeapSnapshot* TakeSnapshotImpl(const char* name, | 88 HeapSnapshot* TakeSnapshotImpl( |
85 int type, | 89 const char* name, |
86 v8::ActivityControl* control); | 90 int type, |
87 HeapSnapshot* TakeSnapshotImpl(String* name, | 91 v8::ActivityControl* control, |
88 int type, | 92 v8::HeapProfiler::ObjectNameResolver* resolver); |
89 v8::ActivityControl* control); | 93 HeapSnapshot* TakeSnapshotImpl( |
| 94 String* name, |
| 95 int type, |
| 96 v8::ActivityControl* control, |
| 97 v8::HeapProfiler::ObjectNameResolver* resolver); |
90 void ResetSnapshots(); | 98 void ResetSnapshots(); |
91 | 99 |
92 void StartHeapObjectsTrackingImpl(); | 100 void StartHeapObjectsTrackingImpl(); |
93 void StopHeapObjectsTrackingImpl(); | 101 void StopHeapObjectsTrackingImpl(); |
94 SnapshotObjectId PushHeapObjectsStatsImpl(OutputStream* stream); | 102 SnapshotObjectId PushHeapObjectsStatsImpl(OutputStream* stream); |
95 | 103 |
96 HeapSnapshotsCollection* snapshots_; | 104 HeapSnapshotsCollection* snapshots_; |
97 unsigned next_snapshot_uid_; | 105 unsigned next_snapshot_uid_; |
98 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; | 106 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
99 }; | 107 }; |
100 | 108 |
101 } } // namespace v8::internal | 109 } } // namespace v8::internal |
102 | 110 |
103 #endif // V8_HEAP_PROFILER_H_ | 111 #endif // V8_HEAP_PROFILER_H_ |
OLD | NEW |