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 19 matching lines...) Expand all Loading... |
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 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 class HeapSnapshot; | 37 class HeapSnapshot; |
38 class HeapSnapshotsCollection; | 38 class HeapSnapshotsCollection; |
39 | 39 |
40 #define HEAP_PROFILE(heap, call) \ | |
41 do { \ | |
42 v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \ | |
43 if (profiler != NULL && profiler->is_profiling()) { \ | |
44 profiler->call; \ | |
45 } \ | |
46 } while (false) | |
47 | |
48 class HeapProfiler { | 40 class HeapProfiler { |
49 public: | 41 public: |
50 explicit HeapProfiler(Heap* heap); | 42 explicit HeapProfiler(Heap* heap); |
51 ~HeapProfiler(); | 43 ~HeapProfiler(); |
52 | 44 |
53 size_t GetMemorySizeUsedByProfiler(); | 45 size_t GetMemorySizeUsedByProfiler(); |
54 | 46 |
55 HeapSnapshot* TakeSnapshot( | 47 HeapSnapshot* TakeSnapshot( |
56 const char* name, | 48 const char* name, |
57 v8::ActivityControl* control, | 49 v8::ActivityControl* control, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 101 |
110 HeapSnapshotsCollection* snapshots_; | 102 HeapSnapshotsCollection* snapshots_; |
111 unsigned next_snapshot_uid_; | 103 unsigned next_snapshot_uid_; |
112 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; | 104 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
113 bool is_tracking_allocations_; | 105 bool is_tracking_allocations_; |
114 }; | 106 }; |
115 | 107 |
116 } } // namespace v8::internal | 108 } } // namespace v8::internal |
117 | 109 |
118 #endif // V8_HEAP_PROFILER_H_ | 110 #endif // V8_HEAP_PROFILER_H_ |
OLD | NEW |