10367 </capabilityfield> |
10367 </capabilityfield> |
10368 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11"> |
10368 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11"> |
10369 <description> |
10369 <description> |
10370 Can generate sampled allocation events. |
10370 Can generate sampled allocation events. |
10371 If this capability is enabled then the heap sampling method |
10371 If this capability is enabled then the heap sampling method |
10372 <functionlink id="SetHeapSamplingRate"></functionlink> can be |
10372 <functionlink id="SetHeapSamplingInterval"></functionlink> can be |
10373 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated. |
10373 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated. |
10374 </description> |
10374 </description> |
10375 </capabilityfield> |
10375 </capabilityfield> |
10376 </capabilitiestypedef> |
10376 </capabilitiestypedef> |
10377 |
10377 |
11550 </function> |
11550 </function> |
11551 |
11551 |
11552 </category> |
11552 </category> |
11553 |
11553 |
11554 <category id="heap_monitoring" label="Heap Monitoring"> |
11554 <category id="heap_monitoring" label="Heap Monitoring"> |
11555 <function id="SetHeapSamplingRate" phase="onload" num="156" since="11"> |
11555 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11"> |
11556 <synopsis>Set Heap Sampling Rate</synopsis> |
11556 <synopsis>Set Heap Sampling Interval</synopsis> |
11557 <description> |
11557 <description> |
11558 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated. |
11558 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated. |
11559 Each thread keeps a counter of bytes allocated. The event will only be generated |
11559 Each thread keeps a counter of bytes allocated. The event will only be generated |
11560 when that counter exceeds an average of <paramlink id="sampling_rate"></paramlink> |
11560 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink> |
11561 since the last sample. |
11561 since the last sample. |
11562 <p/> |
11562 <p/> |
11563 Setting <paramlink id="sampling_rate"></paramlink> to 0 will cause an event to be |
11563 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be |
11564 generated by each allocation supported by the system. |
11564 generated by each allocation supported by the system once the new interval is taken into account. |
|
11565 <p/> |
|
11566 Note that updating the new sampling interval might take various number of allocations |
|
11567 to provoke internal data structure updates. Therefore it is important to |
|
11568 consider the sampling interval as an average. This includes the interval 0, where events |
|
11569 might not be generated straight away for each allocation. |
11565 </description> |
11570 </description> |
11566 <origin>new</origin> |
11571 <origin>new</origin> |
11567 <capabilities> |
11572 <capabilities> |
11568 <required id="can_generate_sampled_object_alloc_events"></required> |
11573 <required id="can_generate_sampled_object_alloc_events"></required> |
11569 </capabilities> |
11574 </capabilities> |
11570 <parameters> |
11575 <parameters> |
11571 <param id="sampling_rate"> |
11576 <param id="sampling_interval"> |
11572 <jint/> |
11577 <jint/> |
11573 <description> |
11578 <description> |
11574 The sampling rate in bytes. The sampler uses a statistical approach to |
11579 The sampling interval in bytes. The sampler uses a statistical approach to |
11575 generate an event, on average, once for every <paramlink id="sampling_rate"/> bytes of |
11580 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of |
11576 memory allocated by a given thread. |
11581 memory allocated by a given thread. |
11577 <p/> |
11582 <p/> |
11578 Passing 0 as a sampling rate generates a sample for every allocation. |
11583 Once the new sampling interval is taken into account, 0 as a sampling interval will generate |
|
11584 a sample for every allocation. |
11579 <p/> |
11585 <p/> |
11580 Note: The overhead of this feature is directly correlated with the sampling rate. |
11586 Note: The overhead of this feature is directly correlated with the sampling interval. |
11581 A high sampling rate, such as 1024 bytes, will incur a high overhead. |
11587 A high sampling interval, such as 1024 bytes, will incur a high overhead. |
11582 A lower rate, such as 1024KB, will have a much lower overhead. Sampling should only |
11588 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only |
11583 be used with an understanding that it may impact performance. |
11589 be used with an understanding that it may impact performance. |
11584 </description> |
11590 </description> |
11585 </param> |
11591 </param> |
11586 </parameters> |
11592 </parameters> |
11587 <errors> |
11593 <errors> |
11588 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> |
11594 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT"> |
11589 <paramlink id="sampling_rate"></paramlink> is less than zero. |
11595 <paramlink id="sampling_interval"></paramlink> is less than zero. |
11590 </error> |
11596 </error> |
11591 </errors> |
11597 </errors> |
11592 </function> |
11598 </function> |
11593 </category> |
11599 </category> |
11594 |
11600 |
13584 |
13590 |
13585 <event label="Sampled Object Allocation" |
13591 <event label="Sampled Object Allocation" |
13586 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" num="86" since="11"> |
13592 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" num="86" since="11"> |
13587 <description> |
13593 <description> |
13588 Sent when an allocated object is sampled. |
13594 Sent when an allocated object is sampled. |
13589 By default, the sampling rate is a geometric variable with a 512KB mean. |
13595 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid |
|
13596 pattern-based bias and provides an approximate overall average interval over long periods of |
|
13597 sampling. |
|
13598 <p/> |
13590 Each thread tracks how many bytes it has allocated since it sent the last event. |
13599 Each thread tracks how many bytes it has allocated since it sent the last event. |
13591 When the number of bytes exceeds the sampling rate, it will send another event. |
13600 When the number of bytes exceeds the sampling interval, it will send another event. |
13592 This implies that, on average, one object will be sampled every time a thread has |
13601 This implies that, on average, one object will be sampled every time a thread has |
13593 allocated 512KB bytes since the last sample. |
13602 allocated 512KB bytes since the last sample. |
13594 <p/> |
13603 <p/> |
13595 Note that this is a geometric variable: it will not sample every 512KB precisely. |
13604 Note that the sampler is pseudo-random: it will not sample every 512KB precisely. |
13596 The goal of this is to ensure high quality sampling even if allocation is |
13605 The goal of this is to ensure high quality sampling even if allocation is |
13597 happening in a fixed pattern (i.e., the same set of objects are being allocated |
13606 happening in a fixed pattern (i.e., the same set of objects are being allocated |
13598 every 512KB). |
13607 every 512KB). |
13599 <p/> |
13608 <p/> |
13600 If another sampling rate is required, the user can call |
13609 If another sampling interval is required, the user can call |
13601 <functionlink id="SetHeapSamplingRate"></functionlink> with a strictly positive integer value, representing |
13610 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value, |
13602 the new sampling rate. |
13611 representing the new sampling interval. |
13603 <p/> |
13612 <p/> |
13604 This event is sent once the sampled allocation has been performed. It provides the object, stack trace |
13613 This event is sent once the sampled allocation has been performed. It provides the object, stack trace |
13605 of the allocation, the thread allocating, the size of allocation, and the object's class. |
13614 of the allocation, the thread allocating, the size of allocation, and the object's class. |
13606 <p/> |
13615 <p/> |
13607 A typical use case of this system is to determine where heap allocations originate. |
13616 A typical use case of this system is to determine where heap allocations originate. |