|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
52 | 52 | #include "memory/heapInspection.hpp"
|
53 | 53 | #include "memory/resourceArea.hpp"
|
54 | 54 | #include "oops/oop.inline.hpp"
|
| 55 | +#include "prims/jvmtiAgentList.hpp" |
55 | 56 | #include "runtime/arguments.hpp"
|
56 | 57 | #include "runtime/flags/jvmFlag.hpp"
|
57 | 58 | #include "runtime/globals.hpp"
|
@@ -269,6 +270,43 @@ TRACE_REQUEST_FUNC(SystemProcess) {
|
269 | 270 | }
|
270 | 271 | }
|
271 | 272 |
|
| 273 | +template <typename AgentEvent> |
| 274 | +static void send_agent_event(AgentEvent& event, const JvmtiAgent* agent) { |
| 275 | + event.set_name(agent->name()); |
| 276 | + event.set_options(agent->options()); |
| 277 | + event.set_dynamic(agent->is_dynamic()); |
| 278 | + event.set_initializationTime(agent->initialization_time()); |
| 279 | + event.set_initializationDuration(agent->initialization_duration()); |
| 280 | + event.commit(); |
| 281 | +} |
| 282 | + |
| 283 | +TRACE_REQUEST_FUNC(JavaAgent) { |
| 284 | + const JvmtiAgentList::Iterator it =JvmtiAgentList::java_agents(); |
| 285 | + while (it.has_next()) { |
| 286 | + const JvmtiAgent* agent = it.next(); |
| 287 | + assert(agent->is_jplis(), "invariant"); |
| 288 | + EventJavaAgent event; |
| 289 | + send_agent_event(event, agent); |
| 290 | + } |
| 291 | +} |
| 292 | + |
| 293 | +static void send_native_agent_events(const JvmtiAgentList::Iterator& it) { |
| 294 | + while (it.has_next()) { |
| 295 | + const JvmtiAgent* agent = it.next(); |
| 296 | + assert(!agent->is_jplis(), "invariant"); |
| 297 | + EventNativeAgent event; |
| 298 | + event.set_path(agent->os_lib_path()); |
| 299 | + send_agent_event(event, agent); |
| 300 | + } |
| 301 | +} |
| 302 | + |
| 303 | +TRACE_REQUEST_FUNC(NativeAgent) { |
| 304 | + const JvmtiAgentList::Iterator native_agents_it = JvmtiAgentList::native_agents(); |
| 305 | + send_native_agent_events(native_agents_it); |
| 306 | + const JvmtiAgentList::Iterator xrun_agents_it = JvmtiAgentList::xrun_agents(); |
| 307 | + send_native_agent_events(xrun_agents_it); |
| 308 | +} |
| 309 | + |
272 | 310 | TRACE_REQUEST_FUNC(ThreadContextSwitchRate) {
|
273 | 311 | double rate = 0.0;
|
274 | 312 | int ret_val = OS_ERR;
|
|
0 commit comments