1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/prims/jvmtiTrace.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,98 @@ 1.4 +/* 1.5 + * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +/////////////////////////////////////////////////////////////// 1.29 +// 1.30 +// class JvmtiTrace 1.31 +// 1.32 +// Support for JVMTI tracing code 1.33 +// 1.34 + 1.35 +// Support tracing except in product build on the client compiler 1.36 +#ifndef PRODUCT 1.37 +#define JVMTI_TRACE 1 1.38 +#else 1.39 +#ifdef COMPILER2 1.40 +#define JVMTI_TRACE 1 1.41 +#endif 1.42 +#endif 1.43 + 1.44 +#ifdef JVMTI_TRACE 1.45 + 1.46 +class JvmtiTrace : AllStatic { 1.47 + 1.48 + static bool _initialized; 1.49 + static bool _on; 1.50 + static bool _trace_event_controller; 1.51 + static jbyte _trace_flags[]; 1.52 + static jbyte _event_trace_flags[]; 1.53 + static const char* _event_names[]; 1.54 + static jint _max_function_index; 1.55 + static jint _max_event_index; 1.56 + static short _exclude_functions[]; 1.57 + static const char* _function_names[]; 1.58 + 1.59 +public: 1.60 + 1.61 + enum { 1.62 + SHOW_IN = 01, 1.63 + SHOW_OUT = 02, 1.64 + SHOW_ERROR = 04, 1.65 + SHOW_IN_DETAIL = 010, 1.66 + SHOW_OUT_DETAIL = 020, 1.67 + SHOW_EVENT_TRIGGER = 040, 1.68 + SHOW_EVENT_SENT = 0100 1.69 + }; 1.70 + 1.71 + static bool tracing() { return _on; } 1.72 + static bool trace_event_controller() { return _trace_event_controller; } 1.73 + static jbyte trace_flags(int num) { return _trace_flags[num]; } 1.74 + static jbyte event_trace_flags(int num) { return _event_trace_flags[num]; } 1.75 + static const char* function_name(int num) { return _function_names[num]; } // To Do: add range checking 1.76 + 1.77 + static const char* event_name(int num) { 1.78 + static char* ext_event_name = (char*)"(extension event)"; 1.79 + if (num >= JVMTI_MIN_EVENT_TYPE_VAL && num <= JVMTI_MAX_EVENT_TYPE_VAL) { 1.80 + return _event_names[num]; 1.81 + } else { 1.82 + return ext_event_name; 1.83 + } 1.84 + } 1.85 + 1.86 + static const char* enum_name(const char** names, const jint* values, jint value); 1.87 + 1.88 + static void initialize(); 1.89 + static void shutdown(); 1.90 + 1.91 + // return a valid string no matter what state the thread is in 1.92 + static const char *safe_get_thread_name(Thread *thread); 1.93 + 1.94 + // return the name of the current thread 1.95 + static const char *safe_get_current_thread_name(); 1.96 + 1.97 + // return a valid string no matter what the state of k_mirror 1.98 + static const char *get_class_name(oop k_mirror); 1.99 +}; 1.100 + 1.101 +#endif /*JVMTI_TRACE */