hotspot/src/share/vm/utilities/events.cpp
author jrose
Sat, 09 Apr 2011 21:16:12 -0700
changeset 9124 f60dee480d49
parent 7397 5b173b4ca846
child 10565 dc90c239f4ec
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "memory/allocation.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "runtime/mutexLocker.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "runtime/osThread.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "runtime/threadLocalStorage.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/timer.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "utilities/events.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#ifdef TARGET_OS_FAMILY_linux
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
# include "thread_linux.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#ifdef TARGET_OS_FAMILY_solaris
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
# include "thread_solaris.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    37
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    38
#ifdef TARGET_OS_FAMILY_windows
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    39
# include "thread_windows.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    40
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
////////////////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// Event
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
typedef u4 EventID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
class Event VALUE_OBJ_CLASS_SPEC  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  jlong       _time_tick;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  intx        _thread_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  const char* _format;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  int         _indent;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  intptr_t    _arg_1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  intptr_t    _arg_2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  intptr_t    _arg_3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // only EventBuffer::add_event() can assign event id
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  friend class EventBuffer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  EventID     _id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  void clear() { _format = NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  EventID id() const { return _id; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  void fill(int indent, const char* format, intptr_t arg_1, intptr_t arg_2, intptr_t arg_3) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    _format = format;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    _arg_1  = arg_1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    _arg_2  = arg_2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    _arg_3  = arg_3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    _indent = indent;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    _thread_id = os::current_thread_id();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    _time_tick = os::elapsed_counter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  void print_on(outputStream *st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    if (_format == NULL) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    st->print("  %d", _thread_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    st->print("  %3.2g   ", (double)_time_tick / os::elapsed_frequency());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    st->fill_to(20);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    for (int index = 0; index < _indent; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
      st->print("| ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    st->print_cr(_format, _arg_1, _arg_2, _arg_3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
////////////////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// EventBuffer
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
// Simple lock-free event queue. Every event has a unique 32-bit id.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
// It's fine if two threads add events at the same time, because they
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
// will get different event id, and then write to different buffer location.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
// However, it is assumed that add_event() is quick enough (or buffer size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
// is big enough), so when one thread is adding event, there can't be more
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
// than "size" events created by other threads; otherwise we'll end up having
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
// two threads writing to the same location.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
class EventBuffer : AllStatic {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  static Event* buffer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  static int    size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  static jint   indent;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  static volatile EventID _current_event_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  static EventID get_next_event_id() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    return (EventID)Atomic::add(1, (jint*)&_current_event_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  static void inc_indent() { Atomic::inc(&indent); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  static void dec_indent() { Atomic::dec(&indent); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  static bool get_event(EventID id, Event* event) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    int index = (int)(id % size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    if (buffer[index].id() == id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
      memcpy(event, &buffer[index], sizeof(Event));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      // check id again; if buffer[index] is being updated by another thread,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      // event->id() will contain different value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      return (event->id() == id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
      // id does not match - id is invalid, or event is overwritten
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  // add a new event to the queue; if EventBuffer is full, this call will
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  // overwrite the oldest event in the queue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  static EventID add_event(const char* format,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
                           intptr_t arg_1, intptr_t arg_2, intptr_t arg_3) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    // assign a unique id
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    EventID id = get_next_event_id();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    // event will be copied to buffer[index]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    int index = (int)(id % size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    // first, invalidate id, buffer[index] can't have event with id = index + 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    buffer[index]._id = index + 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    // make sure everyone has seen that buffer[index] is invalid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    OrderAccess::fence();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    // ... before updating its value
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    buffer[index].fill(indent, format, arg_1, arg_2, arg_3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    // finally, set up real event id, now buffer[index] contains valid event
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    OrderAccess::release_store(&(buffer[index]._id), id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    return id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  static void print_last(outputStream *st, int number) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    st->print_cr("[Last %d events in the event buffer]", number);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    st->print_cr("-<thd>-<elapsed sec>-<description>---------------------");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    int count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    EventID id = _current_event_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    while (count < number) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
      Event event;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
      if (get_event(id, &event)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
         event.print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
      id--;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
      count++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  static void print_all(outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    print_last(st, size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  static void init() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    // Allocate the event buffer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    size   = EventLogLength;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    buffer = NEW_C_HEAP_ARRAY(Event, size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    _current_event_id = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    // Clear the event buffer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    for (int index = 0; index < size; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
      buffer[index]._id = index + 1;       // index + 1 is invalid id
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
      buffer[index].clear();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
Event*           EventBuffer::buffer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
int              EventBuffer::size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
volatile EventID EventBuffer::_current_event_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
int              EventBuffer::indent;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
////////////////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
// Events
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
// Events::log() is safe for signal handlers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
void Events::log(const char* format, ...) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  if (LogEvents) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    va_list ap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
    va_start(ap, format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    intptr_t arg_1 = va_arg(ap, intptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    intptr_t arg_2 = va_arg(ap, intptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    intptr_t arg_3 = va_arg(ap, intptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    va_end(ap);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    EventBuffer::add_event(format, arg_1, arg_2, arg_3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
void Events::print_all(outputStream *st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  EventBuffer::print_all(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
void Events::print_last(outputStream *st, int number) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  EventBuffer::print_last(st, number);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
///////////////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
// EventMark
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
EventMark::EventMark(const char* format, ...) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  if (LogEvents) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    va_list ap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    va_start(ap, format);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    intptr_t arg_1 = va_arg(ap, intptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    intptr_t arg_2 = va_arg(ap, intptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    intptr_t arg_3 = va_arg(ap, intptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    va_end(ap);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    EventBuffer::add_event(format, arg_1, arg_2, arg_3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    EventBuffer::inc_indent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
EventMark::~EventMark() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  if (LogEvents) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    EventBuffer::dec_indent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    EventBuffer::add_event("done", 0, 0, 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
///////////////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
void eventlog_init() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  EventBuffer::init();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
int print_all_events(outputStream *st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  EventBuffer::print_all(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  return 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
void eventlog_init() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
int print_all_events(outputStream *st) { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
#endif // PRODUCT