OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_V8_PROFILER_H_ | 5 #ifndef V8_V8_PROFILER_H_ |
6 #define V8_V8_PROFILER_H_ | 6 #define V8_V8_PROFILER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 #include "v8.h" // NOLINT(build/include) | 9 #include "v8.h" // NOLINT(build/include) |
10 | 10 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 static const int kNoColumnNumberInfo = Message::kNoColumnInfo; | 508 static const int kNoColumnNumberInfo = Message::kNoColumnInfo; |
509 }; | 509 }; |
510 | 510 |
511 | 511 |
512 /** | 512 /** |
513 * Interface for controlling heap profiling. Instance of the | 513 * Interface for controlling heap profiling. Instance of the |
514 * profiler can be retrieved using v8::Isolate::GetHeapProfiler. | 514 * profiler can be retrieved using v8::Isolate::GetHeapProfiler. |
515 */ | 515 */ |
516 class V8_EXPORT HeapProfiler { | 516 class V8_EXPORT HeapProfiler { |
517 public: | 517 public: |
518 enum SamplingFlags { | |
519 kSamplingNoFlags = 0, | |
520 kSamplingForceGC = 1 << 0, | |
ulan
2016/05/04 13:13:06
To be more descriptive, maybe kSamplingForceGCAtAl
alph
2016/05/04 18:40:16
Don't think we should go into implementation detai
| |
521 }; | |
522 | |
518 /** | 523 /** |
519 * Callback function invoked for obtaining RetainedObjectInfo for | 524 * Callback function invoked for obtaining RetainedObjectInfo for |
520 * the given JavaScript wrapper object. It is prohibited to enter V8 | 525 * the given JavaScript wrapper object. It is prohibited to enter V8 |
521 * while the callback is running: only getters on the handle and | 526 * while the callback is running: only getters on the handle and |
522 * GetPointerFromInternalField on the objects are allowed. | 527 * GetPointerFromInternalField on the objects are allowed. |
523 */ | 528 */ |
524 typedef RetainedObjectInfo* (*WrapperInfoCallback)(uint16_t class_id, | 529 typedef RetainedObjectInfo* (*WrapperInfoCallback)(uint16_t class_id, |
525 Local<Value> wrapper); | 530 Local<Value> wrapper); |
526 | 531 |
527 /** Returns the number of snapshots taken. */ | 532 /** Returns the number of snapshots taken. */ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 * newspace allocations. Support for paged space allocation (e.g. pre-tenured | 638 * newspace allocations. Support for paged space allocation (e.g. pre-tenured |
634 * objects, large objects, code objects, etc.) and native allocations | 639 * objects, large objects, code objects, etc.) and native allocations |
635 * doesn't exist yet, but is anticipated in the future. | 640 * doesn't exist yet, but is anticipated in the future. |
636 * | 641 * |
637 * Objects allocated before the sampling is started will not be included in | 642 * Objects allocated before the sampling is started will not be included in |
638 * the profile. | 643 * the profile. |
639 * | 644 * |
640 * Returns false if a sampling heap profiler is already running. | 645 * Returns false if a sampling heap profiler is already running. |
641 */ | 646 */ |
642 bool StartSamplingHeapProfiler(uint64_t sample_interval = 512 * 1024, | 647 bool StartSamplingHeapProfiler(uint64_t sample_interval = 512 * 1024, |
643 int stack_depth = 16); | 648 int stack_depth = 16, |
649 SamplingFlags flags = kSamplingNoFlags); | |
644 | 650 |
645 /** | 651 /** |
646 * Stops the sampling heap profile and discards the current profile. | 652 * Stops the sampling heap profile and discards the current profile. |
647 */ | 653 */ |
648 void StopSamplingHeapProfiler(); | 654 void StopSamplingHeapProfiler(); |
649 | 655 |
650 /** | 656 /** |
651 * Returns the sampled profile of allocations allocated (and still live) since | 657 * Returns the sampled profile of allocations allocated (and still live) since |
652 * StartSamplingHeapProfiler was called. The ownership of the pointer is | 658 * StartSamplingHeapProfiler was called. The ownership of the pointer is |
653 * transfered to the caller. Returns nullptr if sampling heap profiler is not | 659 * transfered to the caller. Returns nullptr if sampling heap profiler is not |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 uint32_t index; // Index of the time interval that was changed. | 779 uint32_t index; // Index of the time interval that was changed. |
774 uint32_t count; // New value of count field for the interval with this index. | 780 uint32_t count; // New value of count field for the interval with this index. |
775 uint32_t size; // New value of size field for the interval with this index. | 781 uint32_t size; // New value of size field for the interval with this index. |
776 }; | 782 }; |
777 | 783 |
778 | 784 |
779 } // namespace v8 | 785 } // namespace v8 |
780 | 786 |
781 | 787 |
782 #endif // V8_V8_PROFILER_H_ | 788 #endif // V8_V8_PROFILER_H_ |
OLD | NEW |