/*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
/* Primary hprof #include file, should be included by most if not
* all hprof source files. Gives access to the global data structure
* and all global macros, and everything declared in the #include
* files of each of the source files.
*/
#ifndef HPROF_H
#define HPROF_H
/* Standard C functions used throughout. */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
#include <limits.h>
#include <time.h>
#include <errno.h>
#include "jni.h"
#include "jvmti.h"
#include "classfile_constants.h"
#include "jvm_md.h"
#ifndef SKIP_NPT
#include "npt.h" /* To get NptEnv for doing character conversions */
#endif
/* Macros to extract the upper and lower 32 bits of a jlong */
#define jlong_add(a, b) ((a) + (b))
/* The type used to contain a generic 32bit "serial number". */
typedef unsigned SerialNumber;
/* How the options get to OnLoad: */
/* Name of prelude file, found at runtime relative to java binary location */
/* File I/O buffer size to be used with any file i/o operation */
/* Machine dependent functions. */
#include "hprof_md.h"
/* Table index types */
typedef unsigned TableIndex;
/* Index for method tables in classes */
typedef int MethodIndex;
/* The different kinds of class status bits. */
enum ClassStatus {
};
/* The different kind of objects we track with heap=dump */
typedef unsigned char ObjectKind;
enum {
};
/* Used by site_write() when writing out the heap=sites data. */
enum {
};
/* Used to hold information about a field, and potentially a value too. */
typedef struct FieldInfo {
unsigned short modifiers;
unsigned char primType;
unsigned char primSize;
} FieldInfo;
/* Used to hold information about a constant pool entry value for a class. */
typedef struct ConstantPoolValue {
unsigned constant_pool_index;
/* All machine independent functions */
#include "hprof_error.h"
#include "hprof_util.h"
#include "hprof_blocks.h"
#include "hprof_stack.h"
#include "hprof_init.h"
#include "hprof_table.h"
#include "hprof_string.h"
#include "hprof_class.h"
#include "hprof_tracker.h"
#include "hprof_frame.h"
#include "hprof_monitor.h"
#include "hprof_trace.h"
#include "hprof_site.h"
#include "hprof_event.h"
#include "hprof_reference.h"
#include "hprof_object.h"
#include "hprof_loader.h"
#include "hprof_tls.h"
#include "hprof_check.h"
#include "hprof_io.h"
#include "hprof_listener.h"
#include "hprof_cpu.h"
#include "hprof_tag.h"
/* Global data structure */
struct LineTable;
typedef struct {
#ifndef SKIP_NPT
#endif
/* Option settings */
int heap_fd;
char *heapfilename;
int check_fd;
char *checkfilename;
/* Stack of objects freed during GC */
/* Lock for debug_malloc() */
/* Count of classes that JVMTI thinks are active */
/* Used to track callbacks for VM_DEATH */
/* Running totals on all bytes allocated */
/* Running total on all time spent in GC (very rough estimate) */
/* Global Data access Lock */
/* Global Dump lock */
/* Milli-second clock when hprof onload started */
/* Thread class (for starting agent threads) */
/* Agent threads started information */
/* Output buffer, position, size, and position in dump if reading */
char * write_buffer;
int write_buffer_index;
int write_buffer_size;
char * heap_buffer;
int heap_buffer_index;
int heap_buffer_size;
char * check_buffer;
int check_buffer_index;
int check_buffer_size;
/* Serial number counters for tables (see hprof_table.c), classes,
* tls (thread local storage), and traces.
*/
/* The methodID for the Object <init> method. */
/* Keeping track of the tracker class and it's methods */
int tracker_method_count;
struct {
/* Index to some common items */
/* Tables for strings, classes, sites, etc. */
/* Handles to java_crw_demo library */
void * java_crw_demo_library;
void * java_crw_demo_function;
void * java_crw_demo_classname_function;
/* Indication that the agent has been loaded */
} GlobalData;
/* This should be the only 'extern' in the library (not exported). */
extern GlobalData * gdata;
#endif