1 /*
   2  * Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved.
   3  *
   4  * This file is part of the Lock Contention Tracing Subsystem for the HotSpot
   5  * Virtual Machine, which is developed at Christian Doppler Laboratory on
   6  * Monitoring and Evolution of Very-Large-Scale Software Systems. Please
   7  * contact us at <http://mevss.jku.at/> if you need additional information
   8  * or have any questions.
   9  *
  10  * This code is free software; you can redistribute it and/or modify it
  11  * under the terms of the GNU General Public License version 2 only, as
  12  * published by the Free Software Foundation.
  13  *
  14  * This code is distributed in the hope that it will be useful, but WITHOUT
  15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17  * version 2 for more details (a copy is included in the LICENSE file that
  18  * accompanied this code).
  19  *
  20  * You should have received a copy of the GNU General Public License version
  21  * 2 along with this work. If not, see <http://www.gnu.org/licenses/>.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_EVTRACE_TRACETYPES_HPP
  26 #define SHARE_VM_EVTRACE_TRACETYPES_HPP
  27 
  28 #include "utilities/globalDefinitions.hpp"
  29 
  30 #define TRACE_TYPES_DO(fun)         \
  31           fun(u1, event_type      ) \
  32           fun(s8, timestamp       ) \
  33           fun(s8, seq_num         ) \
  34           fun(s8, thread_id       ) \
  35           fun(s4, thread_state    ) \
  36           fun(s4, object_id       ) \
  37           fun(s8, objmonitor_id   ) \
  38           fun(s8, classloader_id  ) \
  39           fun(s8, class_id        ) \
  40           fun(s8, method_id       ) \
  41           fun(s4, method_bci      ) \
  42           fun(s8, stack_id        )
  43 
  44 // Scalar trace stream types
  45 class TraceTypes {
  46 public:
  47 
  48 #define TRACE_TYPE_DECLARE(primitive, name) \
  49   typedef primitive name;
  50 TRACE_TYPES_DO(TRACE_TYPE_DECLARE)
  51 #undef TRACE_TYPE_DECLARE
  52 
  53   enum park_return_code {
  54     _park_return_code_min = -1,
  55     park_normal,
  56     park_timedout,
  57     park_immediate_fast,
  58     park_interrupted_fast,
  59     park_no_wait_time,
  60     park_interrupted_slow,
  61     park_locked,
  62     park_immediate_slow,
  63     park_unknown,
  64     _park_return_code_max,
  65   };
  66 
  67   enum safepoint_reason {
  68     _safepoint_reason_min = -1,
  69     safepoint_periodic,
  70     safepoint_for_vm_op,
  71     _safepoint_reason_max,
  72   };
  73 
  74   enum monitor_enter_wait {
  75     _monitor_enter_wait_min = -1,
  76     enter_no_wait,
  77     enter_after_wait_notify,
  78     enter_after_wait_timeout,
  79     enter_after_wait_other, // interrupt or spurious
  80     _monitor_enter_wait_max,
  81   };
  82 
  83   enum monitor_entered_flags {
  84     _monitor_entered_flags_min = -1,
  85     entered_flags_none = 0,
  86     entered_queued = (1 << 0),
  87     entered_parked = (1 << 1),
  88     _monitor_entered_flags_max,
  89   };
  90 
  91   enum event {
  92     _event_min = -1,
  93 
  94     event_thread_start,
  95     event_thread_name_change,
  96     event_thread_state_change,
  97     event_thread_interrupt,
  98     event_thread_exit,
  99     event_thread_park_begin,
 100     event_thread_park_end,
 101     event_thread_unpark,
 102     event_monitor_inflate,
 103     event_monitor_deflate,
 104     event_monitor_contended_enter,
 105     event_monitor_contended_entered,
 106     event_monitor_contended_exited,
 107     event_monitor_dummy,
 108     event_class_metadata,
 109     event_method_metadata,
 110     event_stack_metadata,
 111     event_identical_stacks_metadata,
 112     event_class_loader_unload,
 113     event_safepoint_begin,
 114     event_safepoint_end,
 115     event_vm_end,
 116     event_metadata_reset,
 117     event_group,
 118 
 119     // NOTE: native monitors and stack traces not implemented in this version
 120     event_native_monitor_info,
 121     event_native_monitor_contended_lock,
 122     event_native_monitor_contended_locked,
 123     event_native_monitor_contended_unlocked,
 124     event_native_monitor_destroy,
 125     event_native_monitor_dummy,
 126     event_stack_metadata_extended,
 127     event_native_symbol_metadata,
 128 
 129     event_marker,
 130 
 131     _event_max,
 132   };
 133 
 134 protected:
 135   TraceTypes() { }
 136 };
 137 
 138 #endif /* SHARE_VM_EVTRACE_TRACETYPES_HPP */