jdk/src/share/demo/jvmti/hprof/hprof.h
author goetz
Thu, 21 Nov 2013 18:29:34 -0800
changeset 22852 1063026e8cee
parent 14698 9294fcf94c46
child 24967 582420f5ab6c
permissions -rw-r--r--
8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization. Summary: Fixed Implicit NULL check optimization for AIX, where the page at address '0' is only write-protected. Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
     2
 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * Redistribution and use in source and binary forms, with or without
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * modification, are permitted provided that the following conditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * are met:
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *   - Redistributions of source code must retain the above copyright
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *     notice, this list of conditions and the following disclaimer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *   - Redistributions in binary form must reproduce the above copyright
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 *     notice, this list of conditions and the following disclaimer in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 *     documentation and/or other materials provided with the distribution.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    15
 *   - Neither the name of Oracle nor the names of its
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *     contributors may be used to endorse or promote products derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 *     from this software without specific prior written permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
10292
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    32
/*
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    33
 * This source code is provided to illustrate the usage of a given feature
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    34
 * or technique and has been deliberately simplified. Additional steps
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    35
 * required for a production-quality application, such as security checks,
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    36
 * input validation and proper error handling, might not be present in
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    37
 * this sample code.
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    38
 */
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    39
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    40
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/* Primary hprof #include file, should be included by most if not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *    all hprof source files. Gives access to the global data structure
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *    and all global macros, and everything declared in the #include
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *    files of each of the source files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#ifndef HPROF_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define HPROF_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
/* Standard C functions used throughout. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#include <stdio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#include <ctype.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#include <stddef.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#include <stdarg.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
#include <limits.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
#include <time.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#include <errno.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
/* General JVM/Java functions, types and macros. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#include <sys/types.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
#include "jni.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#include "jvmti.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#include "classfile_constants.h"
14698
9294fcf94c46 7200297: agent code does not handle multiple boot library path elements correctly
dholmes
parents: 14342
diff changeset
    68
#include "jvm_md.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#ifndef SKIP_NPT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#include "npt.h"   /* To get NptEnv for doing character conversions */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
/* Macros to extract the upper and lower 32 bits of a jlong */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
#define jlong_high(a)    ((jint)((a)>>32))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
#define jlong_low(a)     ((jint)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
#define jlong_to_jint(a)  ((jint)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
#define jint_to_jlong(a) ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
#define jlong_add(a, b) ((a) + (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
/* The type used to contain a generic 32bit "serial number". */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
typedef unsigned SerialNumber;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
/* How the options get to OnLoad: */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
#define AGENTNAME               "hprof"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
#define XRUN                    "-Xrun" AGENTNAME
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
#define AGENTLIB                "-agentlib:" AGENTNAME
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
/* Name of prelude file, found at runtime relative to java binary location */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#define PRELUDE_FILE            "jvm.hprof.txt"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
/* File I/O buffer size to be used with any file i/o operation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
#define FILE_IO_BUFFER_SIZE     (1024*64)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
/* Machine dependent functions. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
#include "hprof_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
/* Table index types */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
typedef unsigned   TableIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
typedef TableIndex ClassIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
typedef TableIndex FrameIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
typedef TableIndex IoNameIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
typedef TableIndex MonitorIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
typedef TableIndex ObjectIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
typedef TableIndex LoaderIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
typedef TableIndex RefIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
typedef TableIndex SiteIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
typedef TableIndex StringIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
typedef TableIndex TlsIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
typedef TableIndex TraceIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
/* Index for method tables in classes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
typedef int        MethodIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
/* The different kinds of class status bits. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
enum ClassStatus {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        CLASS_PREPARED          = 0x00000001,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        CLASS_LOADED            = 0x00000002,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        CLASS_UNLOADED          = 0x00000004,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        CLASS_SPECIAL           = 0x00000008,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        CLASS_IN_LOAD_LIST      = 0x00000010,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        CLASS_SYSTEM            = 0x00000020,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        CLASS_DUMPED            = 0x00000040
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
typedef jint       ClassStatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
/* The different kind of objects we track with heap=dump */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
typedef unsigned char ObjectKind;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        OBJECT_NORMAL = 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        OBJECT_CLASS  = 2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        OBJECT_SYSTEM = 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        OBJECT_HPROF  = 4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        OBJECT_LOADER = 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
/* Used by site_write() when writing out the heap=sites data. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        SITE_DUMP_INCREMENTAL   = 0x01,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        SITE_SORT_BY_ALLOC      = 0x02,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        SITE_FORCE_GC           = 0x04
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
/* Used to hold information about a field, and potentially a value too. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
typedef struct FieldInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    ClassIndex         cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    StringIndex        name_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    StringIndex        sig_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    unsigned short     modifiers;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    unsigned char      primType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    unsigned char      primSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
} FieldInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
/* Used to hold information about a constant pool entry value for a class. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
typedef struct ConstantPoolValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    unsigned    constant_pool_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    StringIndex sig_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    jvalue      value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
} ConstantPoolValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
/* All machine independent functions */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
#include "hprof_error.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
#include "hprof_util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
#include "hprof_blocks.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
#include "hprof_stack.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
#include "hprof_init.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
#include "hprof_table.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
#include "hprof_string.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
#include "hprof_class.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
#include "hprof_tracker.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
#include "hprof_frame.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
#include "hprof_monitor.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
#include "hprof_trace.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
#include "hprof_site.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
#include "hprof_event.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
#include "hprof_reference.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
#include "hprof_object.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
#include "hprof_loader.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
#include "hprof_tls.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
#include "hprof_check.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
#include "hprof_io.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
#include "hprof_listener.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
#include "hprof_cpu.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
#include "hprof_tag.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
/* Global data structure */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
struct LineTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    jvmtiEnv            *jvmti; /* JVMTI env for this session */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    JavaVM              *jvm;   /* JavaVM* for this session */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
#ifndef SKIP_NPT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    NptEnv              *npt;   /* NptEnv* for this session, see npt.h */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    jint                cachedJvmtiVersion; /* JVMTI version number */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    char               *header; /* "JAVA PROFILE 1.0.[12]" */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    jboolean            segmented;  /* JNI_TRUE if 1.0.2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    jlong               maxHeapSegment;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    jlong               maxMemory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /* Option settings */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    char *              options;             /* option string copy */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    char *              utf8_output_filename;/* file=filename */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    int                 net_port;            /* net=hostname:port */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    char *              net_hostname;        /* net=hostname:port */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    char                output_format;       /* format=a|b */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    int                 max_trace_depth;     /* depth=max_trace_depth */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    int                 prof_trace_depth;    /* max_trace_depth or 2 (old) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    int                 sample_interval;     /* interval=sample_interval (ms) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    double              cutoff_point;        /* cutoff=cutoff_point */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    jboolean            cpu_sampling;        /* cpu=samples|y */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    jboolean            cpu_timing;          /* cpu=times */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    jboolean            old_timing_format;   /* cpu=old (old) output format */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    jboolean            heap_dump;           /* heap=dump|all */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    jboolean            alloc_sites;         /* heap=sites|all */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    jboolean            thread_in_traces;    /* thread=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    jboolean            lineno_in_traces;    /* lineno=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    jboolean            dump_on_exit;        /* doe=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    jboolean            micro_state_accounting; /* msa=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    jboolean            force_output;        /* force=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    jboolean            monitor_tracing;     /* monitor=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    jboolean            gc_okay;             /* gc_okay=y|n (Not used) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    unsigned            logflags;            /* logflags=bitmask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    #define DEBUGFLAG_UNPREPARED_CLASSES 0x001
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    unsigned            debugflags;          /* debugflags=bitmask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    jboolean            coredump;            /* coredump=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    jboolean            errorexit;           /* errorexit=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    jboolean            pause;               /* pause=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    jboolean            debug;               /* debug=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    jboolean            verbose;             /* verbose=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    jboolean            primfields;          /* primfields=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    jboolean            primarrays;          /* primarrays=y|n */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    jint                experiment;          /* X=NUMBER */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    int                 fd;             /* file or socket (net=addr). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    jboolean            socket;         /* True if fd is a socket (net=addr). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    jboolean            bci;            /* True if any kind of BCI being done */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    jboolean            obj_watch;      /* True if bci and watching allocs */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    int                 bci_counter;    /* Class BCI counter */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    int                 heap_fd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    char               *output_filename;     /* file=filename */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    char               *heapfilename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    int                 check_fd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    char                *checkfilename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    volatile jboolean   dump_in_process;          /* Dump in process */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    volatile jboolean   jvm_initializing;         /* VMInit happening */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    volatile jboolean   jvm_initialized;          /* VMInit happened */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    volatile jboolean   jvm_shut_down;            /* VMDeath happened */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    jboolean            vm_death_callback_active; /* VMDeath happening */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    /* Stack of objects freed during GC */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    Stack *             object_free_stack;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    jrawMonitorID       object_free_lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /* Lock for debug_malloc() */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    jrawMonitorID       debug_malloc_lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    /* Count of classes that JVMTI thinks are active */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    jint                class_count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    /* Used to track callbacks for VM_DEATH */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    jrawMonitorID       callbackBlock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    jrawMonitorID       callbackLock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    jint                active_callbacks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    /* Running totals on all bytes allocated */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    jlong               total_alloced_bytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    jlong               total_alloced_instances;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    jint                total_live_bytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    jint                total_live_instances;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    /* Running total on all time spent in GC (very rough estimate) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    jlong               gc_start_time;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    jlong               time_in_gc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    /* Global Data access Lock */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    jrawMonitorID       data_access_lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    /* Global Dump lock */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    jrawMonitorID       dump_lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    /* Milli-second clock when hprof onload started */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    jlong               micro_sec_ticks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    /* Thread class (for starting agent threads) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    ClassIndex          thread_cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    /* Agent threads started information */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    jboolean            listener_loop_running;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    jrawMonitorID       listener_loop_lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    jboolean            cpu_loop_running;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    jrawMonitorID       cpu_loop_lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    jrawMonitorID       cpu_sample_lock;        /* cpu=samples loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    jint                gc_finish;              /* Count of GC finish events */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    jboolean            gc_finish_active;       /* True if thread active */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    jboolean            gc_finish_stop_request; /* True if we want it to stop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    jrawMonitorID       gc_finish_lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    jboolean            pause_cpu_sampling; /* temp pause in cpu sampling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    /* Output buffer, position, size, and position in dump if reading */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    char *              write_buffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    int                 write_buffer_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    int                 write_buffer_size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    char *              heap_buffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    int                 heap_buffer_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    int                 heap_buffer_size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    jlong               heap_last_tag_position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    jlong               heap_write_count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    char *              check_buffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    int                 check_buffer_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    int                 check_buffer_size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    /* Serial number counters for tables (see hprof_table.c), classes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     *     tls (thread local storage), and traces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    SerialNumber        table_serial_number_start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    SerialNumber        class_serial_number_start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    SerialNumber        thread_serial_number_start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    SerialNumber        trace_serial_number_start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    SerialNumber        object_serial_number_start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    SerialNumber        frame_serial_number_start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    SerialNumber        gref_serial_number_start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    SerialNumber        table_serial_number_counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    SerialNumber        class_serial_number_counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    SerialNumber        thread_serial_number_counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    SerialNumber        trace_serial_number_counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    SerialNumber        object_serial_number_counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    SerialNumber        frame_serial_number_counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    SerialNumber        gref_serial_number_counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    /* The methodID for the Object <init> method. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    jmethodID           object_init_method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    /* Keeping track of the tracker class and it's methods */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    volatile jint       tracking_engaged;       /* !=0 means it's on */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    ClassIndex          tracker_cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    int                 tracker_method_count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        StringIndex name;               /* String index for name */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        StringIndex sig;                /* String index for signature */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        jmethodID method;       /* Method ID */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    } tracker_methods[12];      /* MAX 12 Tracker class methods */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /* Index to some common items */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    LoaderIndex         system_loader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    SerialNumber        unknown_thread_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    TraceIndex          system_trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    SiteIndex           system_object_site_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    jint                system_class_size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    TraceIndex          hprof_trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    SiteIndex           hprof_site_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    /* Tables for strings, classes, sites, etc. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    struct LookupTable * string_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    struct LookupTable * ioname_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    struct LookupTable * class_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    struct LookupTable * site_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    struct LookupTable * object_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    struct LookupTable * reference_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    struct LookupTable * frame_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    struct LookupTable * trace_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    struct LookupTable * monitor_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    struct LookupTable * tls_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    struct LookupTable * loader_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    /* Handles to java_crw_demo library */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    void * java_crw_demo_library;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    void * java_crw_demo_function;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    void * java_crw_demo_classname_function;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    /* Indication that the agent has been loaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    jboolean isLoaded;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
} GlobalData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
/* This should be the only 'extern' in the library (not exported). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
extern GlobalData * gdata;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
#endif