0N/A/*
1879N/A * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/A#ifndef _JVM_DTRACE_H_
0N/A#define _JVM_DTRACE_H_
0N/A
0N/A/*
0N/A * Interface to dynamically turn on probes in Hotspot JVM. Currently,
0N/A * this interface can be used to dynamically enable certain DTrace
0N/A * probe points that are costly to have "always on".
0N/A */
0N/A
0N/A#ifdef __cplusplus
0N/Aextern "C" {
0N/A#endif
0N/A
0N/A#include <sys/types.h>
0N/A
0N/A
0N/Astruct _jvm_t;
0N/Atypedef struct _jvm_t jvm_t;
0N/A
0N/A
0N/A/* Attach to the given JVM process. Returns NULL on failure.
0N/A jvm_get_last_error() returns last error message. */
0N/Ajvm_t* jvm_attach(pid_t pid);
0N/A
0N/A/* Returns the last error message from this library or NULL if none. */
0N/Aconst char* jvm_get_last_error();
0N/A
0N/A/* few well-known probe type constants for 'probe_types' param below */
0N/A
0N/A#define JVM_DTPROBE_METHOD_ENTRY "method-entry"
0N/A#define JVM_DTPROBE_METHOD_RETURN "method-return"
0N/A#define JVM_DTPROBE_MONITOR_ENTER "monitor-contended-enter"
0N/A#define JVM_DTPROBE_MONITOR_ENTERED "monitor-contended-entered"
0N/A#define JVM_DTPROBE_MONITOR_EXIT "monitor-contended-exit"
0N/A#define JVM_DTPROBE_MONITOR_WAIT "monitor-wait"
0N/A#define JVM_DTPROBE_MONITOR_WAITED "monitor-waited"
0N/A#define JVM_DTPROBE_MONITOR_NOTIFY "monitor-notify"
0N/A#define JVM_DTPROBE_MONITOR_NOTIFYALL "monitor-notifyall"
0N/A#define JVM_DTPROBE_OBJECT_ALLOC "object-alloc"
0N/A#define JVM_DTPROBE_ALL "*"
0N/A
0N/A/* Enable the specified DTrace probes of given probe types on
0N/A * the specified JVM. Returns >= 0 on success, -1 on failure.
0N/A * On success, this returns number of probe_types enabled.
0N/A * On failure, jvm_get_last_error() returns the last error message.
0N/A */
0N/Aint jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types);
0N/A
0N/A/* Note: There is no jvm_disable_dtprobes function. Probes are automatically
0N/A * disabled when there are no more clients requiring those probes.
0N/A */
0N/A
0N/A/* Detach the given JVM. Returns 0 on success, -1 on failure.
0N/A * jvm_get_last_error() returns the last error message.
0N/A */
0N/Aint jvm_detach(jvm_t* jvm);
0N/A
0N/A#ifdef __cplusplus
0N/A}
0N/A#endif
0N/A
0N/A#endif /* _JVM_DTRACE_H_ */