| OLD | NEW |
| 1 // Copyright 2009 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #endif // ENABLE_LOGGING_AND_PROFILING | 51 #endif // ENABLE_LOGGING_AND_PROFILING |
| 52 | 52 |
| 53 // The HeapProfiler writes data to the log files, which can be postprocessed | 53 // The HeapProfiler writes data to the log files, which can be postprocessed |
| 54 // to generate .hp files for use by the GHC/Valgrind tool hp2ps. | 54 // to generate .hp files for use by the GHC/Valgrind tool hp2ps. |
| 55 class HeapProfiler { | 55 class HeapProfiler { |
| 56 public: | 56 public: |
| 57 static void Setup(); | 57 static void Setup(); |
| 58 static void TearDown(); | 58 static void TearDown(); |
| 59 | 59 |
| 60 #ifdef ENABLE_LOGGING_AND_PROFILING | 60 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 61 static HeapSnapshot* TakeSnapshot(const char* name, int type); | 61 static HeapSnapshot* TakeSnapshot(const char* name, |
| 62 static HeapSnapshot* TakeSnapshot(String* name, int type); | 62 int type, |
| 63 v8::ActivityControl* control); |
| 64 static HeapSnapshot* TakeSnapshot(String* name, |
| 65 int type, |
| 66 v8::ActivityControl* control); |
| 63 static int GetSnapshotsCount(); | 67 static int GetSnapshotsCount(); |
| 64 static HeapSnapshot* GetSnapshot(int index); | 68 static HeapSnapshot* GetSnapshot(int index); |
| 65 static HeapSnapshot* FindSnapshot(unsigned uid); | 69 static HeapSnapshot* FindSnapshot(unsigned uid); |
| 66 | 70 |
| 67 void ObjectMoveEvent(Address from, Address to); | 71 void ObjectMoveEvent(Address from, Address to); |
| 68 | 72 |
| 69 INLINE(bool is_profiling()) { | 73 INLINE(bool is_profiling()) { |
| 70 return snapshots_->is_tracking_objects(); | 74 return snapshots_->is_tracking_objects(); |
| 71 } | 75 } |
| 72 | 76 |
| 73 // Obsolete interface. | 77 // Obsolete interface. |
| 74 // Write a single heap sample to the log file. | 78 // Write a single heap sample to the log file. |
| 75 static void WriteSample(); | 79 static void WriteSample(); |
| 76 | 80 |
| 77 private: | 81 private: |
| 78 HeapProfiler(); | 82 HeapProfiler(); |
| 79 ~HeapProfiler(); | 83 ~HeapProfiler(); |
| 80 HeapSnapshot* TakeSnapshotImpl(const char* name, int type); | 84 HeapSnapshot* TakeSnapshotImpl(const char* name, |
| 81 HeapSnapshot* TakeSnapshotImpl(String* name, int type); | 85 int type, |
| 86 v8::ActivityControl* control); |
| 87 HeapSnapshot* TakeSnapshotImpl(String* name, |
| 88 int type, |
| 89 v8::ActivityControl* control); |
| 82 | 90 |
| 83 HeapSnapshotsCollection* snapshots_; | 91 HeapSnapshotsCollection* snapshots_; |
| 84 unsigned next_snapshot_uid_; | 92 unsigned next_snapshot_uid_; |
| 85 | 93 |
| 86 #endif // ENABLE_LOGGING_AND_PROFILING | 94 #endif // ENABLE_LOGGING_AND_PROFILING |
| 87 }; | 95 }; |
| 88 | 96 |
| 89 | 97 |
| 90 #ifdef ENABLE_LOGGING_AND_PROFILING | 98 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 91 | 99 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 friend class Isolate; | 378 friend class Isolate; |
| 371 | 379 |
| 372 DISALLOW_COPY_AND_ASSIGN(ProducerHeapProfile); | 380 DISALLOW_COPY_AND_ASSIGN(ProducerHeapProfile); |
| 373 }; | 381 }; |
| 374 | 382 |
| 375 #endif // ENABLE_LOGGING_AND_PROFILING | 383 #endif // ENABLE_LOGGING_AND_PROFILING |
| 376 | 384 |
| 377 } } // namespace v8::internal | 385 } } // namespace v8::internal |
| 378 | 386 |
| 379 #endif // V8_HEAP_PROFILER_H_ | 387 #endif // V8_HEAP_PROFILER_H_ |
| OLD | NEW |