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

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

Issue 7350014: Remove the ability to compile without logging and profiling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/heap.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
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 15 matching lines...) Expand all
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 "isolate.h" 31 #include "isolate.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 #ifdef ENABLE_LOGGING_AND_PROFILING
37
38 class HeapSnapshot; 36 class HeapSnapshot;
39 class HeapSnapshotsCollection; 37 class HeapSnapshotsCollection;
40 38
41 #define HEAP_PROFILE(heap, call) \ 39 #define HEAP_PROFILE(heap, call) \
42 do { \ 40 do { \
43 v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \ 41 v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \
44 if (profiler != NULL && profiler->is_profiling()) { \ 42 if (profiler != NULL && profiler->is_profiling()) { \
45 profiler->call; \ 43 profiler->call; \
46 } \ 44 } \
47 } while (false) 45 } while (false)
48 #else
49 #define HEAP_PROFILE(heap, call) ((void) 0)
50 #endif // ENABLE_LOGGING_AND_PROFILING
51 46
52 // The HeapProfiler writes data to the log files, which can be postprocessed 47 // The HeapProfiler writes data to the log files, which can be postprocessed
53 // to generate .hp files for use by the GHC/Valgrind tool hp2ps. 48 // to generate .hp files for use by the GHC/Valgrind tool hp2ps.
54 class HeapProfiler { 49 class HeapProfiler {
55 public: 50 public:
56 static void Setup(); 51 static void Setup();
57 static void TearDown(); 52 static void TearDown();
58 53
59 #ifdef ENABLE_LOGGING_AND_PROFILING
60 static HeapSnapshot* TakeSnapshot(const char* name, 54 static HeapSnapshot* TakeSnapshot(const char* name,
61 int type, 55 int type,
62 v8::ActivityControl* control); 56 v8::ActivityControl* control);
63 static HeapSnapshot* TakeSnapshot(String* name, 57 static HeapSnapshot* TakeSnapshot(String* name,
64 int type, 58 int type,
65 v8::ActivityControl* control); 59 v8::ActivityControl* control);
66 static int GetSnapshotsCount(); 60 static int GetSnapshotsCount();
67 static HeapSnapshot* GetSnapshot(int index); 61 static HeapSnapshot* GetSnapshot(int index);
68 static HeapSnapshot* FindSnapshot(unsigned uid); 62 static HeapSnapshot* FindSnapshot(unsigned uid);
69 static void DeleteAllSnapshots(); 63 static void DeleteAllSnapshots();
(...skipping 16 matching lines...) Expand all
86 int type, 80 int type,
87 v8::ActivityControl* control); 81 v8::ActivityControl* control);
88 HeapSnapshot* TakeSnapshotImpl(String* name, 82 HeapSnapshot* TakeSnapshotImpl(String* name,
89 int type, 83 int type,
90 v8::ActivityControl* control); 84 v8::ActivityControl* control);
91 void ResetSnapshots(); 85 void ResetSnapshots();
92 86
93 HeapSnapshotsCollection* snapshots_; 87 HeapSnapshotsCollection* snapshots_;
94 unsigned next_snapshot_uid_; 88 unsigned next_snapshot_uid_;
95 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; 89 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
96
97 #endif // ENABLE_LOGGING_AND_PROFILING
98 }; 90 };
99 91
100 } } // namespace v8::internal 92 } } // namespace v8::internal
101 93
102 #endif // V8_HEAP_PROFILER_H_ 94 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698