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

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

Issue 1356223004: Move heap and CPU profilers into a dedicated directory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebaseline Created 5 years, 2 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/deoptimizer.cc ('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
(Empty)
1 // Copyright 2009-2010 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_HEAP_PROFILER_H_
6 #define V8_HEAP_PROFILER_H_
7
8 #include "src/base/smart-pointers.h"
9 #include "src/isolate.h"
10 #include "src/list.h"
11
12 namespace v8 {
13 namespace internal {
14
15 // Forward declarations.
16 class AllocationTracker;
17 class HeapObjectsMap;
18 class HeapSnapshot;
19 class StringsStorage;
20
21 class HeapProfiler {
22 public:
23 explicit HeapProfiler(Heap* heap);
24 ~HeapProfiler();
25
26 size_t GetMemorySizeUsedByProfiler();
27
28 HeapSnapshot* TakeSnapshot(
29 v8::ActivityControl* control,
30 v8::HeapProfiler::ObjectNameResolver* resolver);
31
32 void StartHeapObjectsTracking(bool track_allocations);
33 void StopHeapObjectsTracking();
34 AllocationTracker* allocation_tracker() const {
35 return allocation_tracker_.get();
36 }
37 HeapObjectsMap* heap_object_map() const { return ids_.get(); }
38 StringsStorage* names() const { return names_.get(); }
39
40 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream,
41 int64_t* timestamp_us);
42 int GetSnapshotsCount();
43 HeapSnapshot* GetSnapshot(int index);
44 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
45 void DeleteAllSnapshots();
46 void RemoveSnapshot(HeapSnapshot* snapshot);
47
48 void ObjectMoveEvent(Address from, Address to, int size);
49
50 void AllocationEvent(Address addr, int size);
51
52 void UpdateObjectSizeEvent(Address addr, int size);
53
54 void DefineWrapperClass(
55 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
56
57 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
58 Object** wrapper);
59 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
60
61 bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
62 bool is_tracking_allocations() const {
63 return !allocation_tracker_.is_empty();
64 }
65
66 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
67 void ClearHeapObjectMap();
68
69 private:
70 Heap* heap() const;
71
72 // Mapping from HeapObject addresses to objects' uids.
73 base::SmartPointer<HeapObjectsMap> ids_;
74 List<HeapSnapshot*> snapshots_;
75 base::SmartPointer<StringsStorage> names_;
76 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
77 base::SmartPointer<AllocationTracker> allocation_tracker_;
78 bool is_tracking_object_moves_;
79 base::Mutex profiler_mutex_;
80 };
81
82 } } // namespace v8::internal
83
84 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698