src/share/vm/prims/jvmtiTrace.hpp

Wed, 11 Jan 2012 17:34:02 -0500

author
phh
date
Wed, 11 Jan 2012 17:34:02 -0500
changeset 3427
94ec88ca68e2
parent 2314
f95d63e2154a
child 4721
47bc9800972c
permissions
-rw-r--r--

7115199: Add event tracing hooks and Java Flight Recorder infrastructure
Summary: Added a nop tracing infrastructure, JFR makefile changes and other infrastructure used only by JFR.
Reviewed-by: acorn, sspitsyn
Contributed-by: markus.gronlund@oracle.com

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_PRIMS_JVMTITRACE_HPP
stefank@2314 26 #define SHARE_VM_PRIMS_JVMTITRACE_HPP
stefank@2314 27
stefank@2314 28 #include "classfile/systemDictionary.hpp"
stefank@2314 29 #include "jvmtifiles/jvmti.h"
stefank@2314 30 #include "oops/objArrayOop.hpp"
stefank@2314 31 #include "prims/jvmtiEnvThreadState.hpp"
stefank@2314 32 #include "prims/jvmtiEventController.hpp"
stefank@2314 33 #include "prims/jvmtiUtil.hpp"
stefank@2314 34 #include "runtime/stackValueCollection.hpp"
stefank@2314 35 #include "runtime/vm_operations.hpp"
stefank@2314 36
duke@435 37 ///////////////////////////////////////////////////////////////
duke@435 38 //
duke@435 39 // class JvmtiTrace
duke@435 40 //
duke@435 41 // Support for JVMTI tracing code
duke@435 42 //
duke@435 43
duke@435 44 // Support tracing except in product build on the client compiler
duke@435 45 #ifndef PRODUCT
duke@435 46 #define JVMTI_TRACE 1
duke@435 47 #else
duke@435 48 #ifdef COMPILER2
duke@435 49 #define JVMTI_TRACE 1
duke@435 50 #endif
duke@435 51 #endif
duke@435 52
duke@435 53 #ifdef JVMTI_TRACE
duke@435 54
duke@435 55 class JvmtiTrace : AllStatic {
duke@435 56
duke@435 57 static bool _initialized;
duke@435 58 static bool _on;
duke@435 59 static bool _trace_event_controller;
duke@435 60 static jbyte _trace_flags[];
duke@435 61 static jbyte _event_trace_flags[];
duke@435 62 static const char* _event_names[];
duke@435 63 static jint _max_function_index;
duke@435 64 static jint _max_event_index;
duke@435 65 static short _exclude_functions[];
duke@435 66 static const char* _function_names[];
duke@435 67
duke@435 68 public:
duke@435 69
duke@435 70 enum {
duke@435 71 SHOW_IN = 01,
duke@435 72 SHOW_OUT = 02,
duke@435 73 SHOW_ERROR = 04,
duke@435 74 SHOW_IN_DETAIL = 010,
duke@435 75 SHOW_OUT_DETAIL = 020,
duke@435 76 SHOW_EVENT_TRIGGER = 040,
duke@435 77 SHOW_EVENT_SENT = 0100
duke@435 78 };
duke@435 79
duke@435 80 static bool tracing() { return _on; }
duke@435 81 static bool trace_event_controller() { return _trace_event_controller; }
duke@435 82 static jbyte trace_flags(int num) { return _trace_flags[num]; }
duke@435 83 static jbyte event_trace_flags(int num) { return _event_trace_flags[num]; }
duke@435 84 static const char* function_name(int num) { return _function_names[num]; } // To Do: add range checking
duke@435 85
duke@435 86 static const char* event_name(int num) {
duke@435 87 static char* ext_event_name = (char*)"(extension event)";
duke@435 88 if (num >= JVMTI_MIN_EVENT_TYPE_VAL && num <= JVMTI_MAX_EVENT_TYPE_VAL) {
duke@435 89 return _event_names[num];
duke@435 90 } else {
duke@435 91 return ext_event_name;
duke@435 92 }
duke@435 93 }
duke@435 94
duke@435 95 static const char* enum_name(const char** names, const jint* values, jint value);
duke@435 96
duke@435 97 static void initialize();
duke@435 98 static void shutdown();
duke@435 99
duke@435 100 // return a valid string no matter what state the thread is in
duke@435 101 static const char *safe_get_thread_name(Thread *thread);
duke@435 102
duke@435 103 // return the name of the current thread
duke@435 104 static const char *safe_get_current_thread_name();
duke@435 105
duke@435 106 // return a valid string no matter what the state of k_mirror
duke@435 107 static const char *get_class_name(oop k_mirror);
duke@435 108 };
duke@435 109
duke@435 110 #endif /*JVMTI_TRACE */
stefank@2314 111
stefank@2314 112 #endif // SHARE_VM_PRIMS_JVMTITRACE_HPP

mercurial