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

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

Issue 3020002: Heap profiler: implement diffing of snapshots. (Closed)
Patch Set: Comments addressed Created 10 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
« 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 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 41 #define HEAP_PROFILE(Call) \
42 do { \
43 if (v8::internal::HeapProfiler::is_profiling()) { \
44 v8::internal::HeapProfiler::Call; \
45 } \
46 } while (false)
47 #else
48 #define HEAP_PROFILE(Call) ((void) 0)
49 #endif // ENABLE_LOGGING_AND_PROFILING
42 50
43 // The HeapProfiler writes data to the log files, which can be postprocessed 51 // The HeapProfiler writes data to the log files, which can be postprocessed
44 // to generate .hp files for use by the GHC/Valgrind tool hp2ps. 52 // to generate .hp files for use by the GHC/Valgrind tool hp2ps.
45 class HeapProfiler { 53 class HeapProfiler {
46 public: 54 public:
47 static void Setup(); 55 static void Setup();
48 static void TearDown(); 56 static void TearDown();
49 57
50 #ifdef ENABLE_LOGGING_AND_PROFILING 58 #ifdef ENABLE_LOGGING_AND_PROFILING
51 static HeapSnapshot* TakeSnapshot(const char* name); 59 static HeapSnapshot* TakeSnapshot(const char* name);
52 static HeapSnapshot* TakeSnapshot(String* name); 60 static HeapSnapshot* TakeSnapshot(String* name);
53 static int GetSnapshotsCount(); 61 static int GetSnapshotsCount();
54 static HeapSnapshot* GetSnapshot(int index); 62 static HeapSnapshot* GetSnapshot(int index);
55 static HeapSnapshot* FindSnapshot(unsigned uid); 63 static HeapSnapshot* FindSnapshot(unsigned uid);
56 64
65 static void ObjectMoveEvent(Address from, Address to);
66
67 static INLINE(bool is_profiling()) {
68 return singleton_ != NULL && singleton_->snapshots_->is_tracking_objects();
69 }
70
57 // Obsolete interface. 71 // Obsolete interface.
58 // Write a single heap sample to the log file. 72 // Write a single heap sample to the log file.
59 static void WriteSample(); 73 static void WriteSample();
60 74
61 private: 75 private:
62 HeapProfiler(); 76 HeapProfiler();
63 ~HeapProfiler(); 77 ~HeapProfiler();
64 HeapSnapshot* TakeSnapshotImpl(const char* name); 78 HeapSnapshot* TakeSnapshotImpl(const char* name);
65 HeapSnapshot* TakeSnapshotImpl(String* name); 79 HeapSnapshot* TakeSnapshotImpl(String* name);
66 80
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 private: 314 private:
301 static void DoRecordJSObjectAllocation(Object* obj); 315 static void DoRecordJSObjectAllocation(Object* obj);
302 static bool can_log_; 316 static bool can_log_;
303 }; 317 };
304 318
305 #endif // ENABLE_LOGGING_AND_PROFILING 319 #endif // ENABLE_LOGGING_AND_PROFILING
306 320
307 } } // namespace v8::internal 321 } } // namespace v8::internal
308 322
309 #endif // V8_HEAP_PROFILER_H_ 323 #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