jdk/src/share/classes/com/sun/tracing/Probe.java
author never
Mon, 12 Jul 2010 22:27:18 -0700
changeset 5926 a36f90d986b6
parent 5506 202f599c92aa
permissions -rw-r--r--
6968385: malformed xml in sweeper logging Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
406
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
     2
 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
491
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     4
 *
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
491
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
491
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    10
 *
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    15
 * accompanied this code).
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    16
 *
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a394684ccfe6 6697875: Copyright headers need to be upgraded with GPL derivative
kamg
parents: 406
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 491
diff changeset
    23
 * questions.
406
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    24
 */
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    25
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    26
package com.sun.tracing;
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    27
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    28
/**
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    29
 * The {@code Probe} interface represents a tracepoint.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    30
 *
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    31
 * A {@code Probe} instance is obtained by calling the
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    32
 * {@code Provider.getProbe()} method of a provider instance created by
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    33
 * {@code ProviderFactory.createProvider()}.  A {@code Probe} can be used to
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    34
 * trigger a probe manually (provided the correct arguments are passed to
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    35
 * it), or to check a probe to see if anything is currently tracing it.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    36
 * <p>
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    37
 * A tracing check can be used to avoid lengthy work that might be
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    38
 * needed to set up the probe's arguments.  However, checking
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    39
 * whether the probe is enabled generally takes the same amount of time
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    40
 * as actually triggering the probe. So, you should only check a probe's status
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    41
 * without triggering it if setting up the arguments is very expensive.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    42
 * <p>
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    43
 * Users do not need to implement this interface: instances are
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    44
 * created automatically by the system when a {@code Provider)} instance is
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    45
 * created.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    46
 * <p>
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    47
 * @since 1.7
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    48
 */
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    49
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    50
public interface Probe {
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    51
    /**
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    52
     * Checks whether there is an active trace of this probe.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    53
     *
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    54
     * @return true if an active trace is detected.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    55
     */
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    56
    boolean isEnabled();
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    57
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    58
    /**
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    59
     * Determines whether a tracepoint is enabled.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    60
     *
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    61
     * Typically, users do not need to use this method. It is called
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    62
     * automatically when a Provider's instance method is called. Calls to
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    63
     * this method expect the arguments to match the declared parameters for
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    64
     * the method associated with the probe.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    65
     *
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    66
     * @param args the parameters to pass to the method.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    67
     * @throws IllegalArgumentException if the provided parameters do not
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    68
     * match the method declaration for this probe.
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    69
     */
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    70
    void trigger(Object ... args);
bde3a21bcab0 6690122: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
diff changeset
    71
}