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

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

Issue 2800009: Fix issue 738: make compilable with profilingsupport=off (Closed)
Patch Set: Created 10 years, 6 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 | « no previous file | 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 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 20 matching lines...) Expand all
31 #include "zone-inl.h" 31 #include "zone-inl.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 #ifdef ENABLE_LOGGING_AND_PROFILING 36 #ifdef ENABLE_LOGGING_AND_PROFILING
37 37
38 class HeapSnapshot; 38 class HeapSnapshot;
39 class HeapSnapshotsCollection; 39 class HeapSnapshotsCollection;
40 40
41 #endif
42
41 // The HeapProfiler writes data to the log files, which can be postprocessed 43 // The HeapProfiler writes data to the log files, which can be postprocessed
42 // to generate .hp files for use by the GHC/Valgrind tool hp2ps. 44 // to generate .hp files for use by the GHC/Valgrind tool hp2ps.
43 class HeapProfiler { 45 class HeapProfiler {
44 public: 46 public:
45 static void Setup(); 47 static void Setup();
46 static void TearDown(); 48 static void TearDown();
49
50 #ifdef ENABLE_LOGGING_AND_PROFILING
47 static HeapSnapshot* TakeSnapshot(const char* name); 51 static HeapSnapshot* TakeSnapshot(const char* name);
48 static HeapSnapshot* TakeSnapshot(String* name); 52 static HeapSnapshot* TakeSnapshot(String* name);
49 static int GetSnapshotsCount(); 53 static int GetSnapshotsCount();
50 static HeapSnapshot* GetSnapshot(int index); 54 static HeapSnapshot* GetSnapshot(int index);
51 static HeapSnapshot* FindSnapshot(unsigned uid); 55 static HeapSnapshot* FindSnapshot(unsigned uid);
52 56
53 // Obsolete interface. 57 // Obsolete interface.
54 // Write a single heap sample to the log file. 58 // Write a single heap sample to the log file.
55 static void WriteSample(); 59 static void WriteSample();
56 60
57 private: 61 private:
58 HeapProfiler(); 62 HeapProfiler();
59 ~HeapProfiler(); 63 ~HeapProfiler();
60 HeapSnapshot* TakeSnapshotImpl(const char* name); 64 HeapSnapshot* TakeSnapshotImpl(const char* name);
61 HeapSnapshot* TakeSnapshotImpl(String* name); 65 HeapSnapshot* TakeSnapshotImpl(String* name);
62 66
63 // Obsolete interface. 67 // Obsolete interface.
64 // Update the array info with stats from obj. 68 // Update the array info with stats from obj.
65 static void CollectStats(HeapObject* obj, HistogramInfo* info); 69 static void CollectStats(HeapObject* obj, HistogramInfo* info);
66 70
67 HeapSnapshotsCollection* snapshots_; 71 HeapSnapshotsCollection* snapshots_;
68 unsigned next_snapshot_uid_; 72 unsigned next_snapshot_uid_;
69 73
70 static HeapProfiler* singleton_; 74 static HeapProfiler* singleton_;
75 #endif // ENABLE_LOGGING_AND_PROFILING
71 }; 76 };
72 77
73 78
79 #ifdef ENABLE_LOGGING_AND_PROFILING
80
74 // JSObjectsCluster describes a group of JS objects that are 81 // JSObjectsCluster describes a group of JS objects that are
75 // considered equivalent in terms of a particular profile. 82 // considered equivalent in terms of a particular profile.
76 class JSObjectsCluster BASE_EMBEDDED { 83 class JSObjectsCluster BASE_EMBEDDED {
77 public: 84 public:
78 // These special cases are used in retainer profile. 85 // These special cases are used in retainer profile.
79 enum SpecialCase { 86 enum SpecialCase {
80 ROOTS = 1, 87 ROOTS = 1,
81 GLOBAL_PROPERTY = 2, 88 GLOBAL_PROPERTY = 2,
82 CODE = 3, 89 CODE = 3,
83 SELF = 100 // This case is used in ClustersCoarser only. 90 SELF = 100 // This case is used in ClustersCoarser only.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 private: 300 private:
294 static void DoRecordJSObjectAllocation(Object* obj); 301 static void DoRecordJSObjectAllocation(Object* obj);
295 static bool can_log_; 302 static bool can_log_;
296 }; 303 };
297 304
298 #endif // ENABLE_LOGGING_AND_PROFILING 305 #endif // ENABLE_LOGGING_AND_PROFILING
299 306
300 } } // namespace v8::internal 307 } } // namespace v8::internal
301 308
302 #endif // V8_HEAP_PROFILER_H_ 309 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698