|
6 | 6 | import org.openjdk.jmc.common.item.IItemCollection;
|
7 | 7 | import org.openjdk.jmc.common.item.IItemIterable;
|
8 | 8 | import org.openjdk.jmc.common.item.IMemberAccessor;
|
| 9 | +import org.openjdk.jmc.common.unit.IQuantity; |
9 | 10 | import org.openjdk.jmc.flightrecorder.jdk.JdkAttributes;
|
10 | 11 |
|
11 | 12 | import java.lang.reflect.Constructor;
|
@@ -42,6 +43,29 @@ public void test() throws Exception {
|
42 | 43 | System.out.println(count);
|
43 | 44 | stopProfiler();
|
44 | 45 | IItemCollection executionSamples = verifyEvents("datadog.ExecutionSample");
|
| 46 | + |
| 47 | + // Check profiler counters for contention drops |
| 48 | + IItemCollection profilerCounters = verifyEvents("datadog.ProfilerCounter"); |
| 49 | + long contentionDrops = 0; |
| 50 | + int countersNum = 0; |
| 51 | + for (IItemIterable counters : profilerCounters) { |
| 52 | + countersNum++; |
| 53 | + IMemberAccessor<String, IItem> nameAccessor = NAME.getAccessor(counters.getType()); |
| 54 | + IMemberAccessor<IQuantity, IItem> countAccessor = COUNT.getAccessor(counters.getType()); |
| 55 | + for (IItem item : counters) { |
| 56 | + String name = nameAccessor.getMember(item); |
| 57 | + if ("calltrace_storage_dropped_traces".equals(name)) { |
| 58 | + IQuantity value = countAccessor.getMember(item); |
| 59 | + if (value != null) { |
| 60 | + contentionDrops = value.longValue(); |
| 61 | + break; |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | + if (contentionDrops > 0) break; |
| 66 | + } |
| 67 | + assertTrue(contentionDrops > 0, "Contention drops should be non-zero"); |
| 68 | + System.out.println("Contention drops detected: " + contentionDrops); |
45 | 69 | Matcher[] forbiddenPatternMatchers = Stream.of(
|
46 | 70 | "MH.*0x[A-Fa-f0-9]{3}", // method handles
|
47 | 71 | "GeneratedConstructorAccessor\\d+",
|
|
0 commit comments