opagent.h File Reference

#include <sys/types.h>
Include dependency graph for opagent.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  debug_line_info

Typedefs

typedef void * op_agent_t

Functions

op_agent_t op_open_agent (void)
int op_close_agent (op_agent_t hdl)
int op_write_native_code (op_agent_t hdl, char const *symbol_name, uint64_t vma, void const *code, const unsigned int code_size)
int op_write_debug_line_info (op_agent_t hdl, void const *code, size_t nr_entry, struct debug_line_info const *compile_map)
int op_unload_native_code (op_agent_t hdl, uint64_t vma)
int op_major_version (void)
int op_minor_version (void)

Detailed Description

Interface to report symbol names and dynamically generated code to Oprofile

Remarks:
Copyright 2007 OProfile authors

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Author:
Jens Wilke Daniel Hansel

Copyright IBM Corporation 2007

Definition in file opagent.h.


Typedef Documentation

typedef void* op_agent_t

Definition at line 44 of file opagent.h.


Function Documentation

int op_close_agent ( op_agent_t  hdl  ) 

Frees all resources and closes open file handles.

hdl: Handle returned from an earlier call to op_open_agent()

Returns 0 on success; -1 otherwise. If -1 is returned, errno is set to indicate the nature of the error.

Definition at line 197 of file opagent.c.

References jr_code_close::id, JIT_CODE_CLOSE, jr_code_close::timestamp, and jr_code_close::total_size.

Referenced by Agent_OnUnload(), and jvm_shutdown().

Here is the caller graph for this function:

int op_major_version ( void   ) 

Returns the major version number of the libopagent library that will be used.

Definition at line 382 of file opagent.c.

References OP_MAJOR_VERSION.

Referenced by Agent_OnLoad(), and JVM_OnLoad().

Here is the caller graph for this function:

int op_minor_version ( void   ) 

Returns the minor version number of the libopagent library that will be used.

Definition at line 387 of file opagent.c.

References OP_MINOR_VERSION.

Referenced by Agent_OnLoad(), and JVM_OnLoad().

Here is the caller graph for this function:

op_agent_t op_open_agent ( void   ) 

This function must be called by agents before any other function. Creates and opens a JIT dump file in /var/lib/oprofile/jitdump using the naming convention <process_id>.dump.

Returns a valid op_agent_t handle or NULL. If NULL is returned, errno is set to indicate the nature of the error.

Definition at line 125 of file opagent.c.

References _bfd_arch, _bfd_mach, _bfd_target_name, AGENT_DIR, jitheader::bfd_arch, jitheader::bfd_mach, define_bfd_vars(), JITHEADER_MAGIC, JITHEADER_VERSION, jitheader::magic, PADDING_8ALIGNED, jitheader::timestamp, jitheader::totalsize, and jitheader::version.

Referenced by Agent_OnLoad(), and JVM_OnLoad().

Here is the call graph for this function:

Here is the caller graph for this function:

int op_unload_native_code ( op_agent_t  hdl,
uint64_t  vma 
)

Signal the invalidation of native code from a virtual machine.

hdl: Handle returned from an earlier call to op_open_agent() vma: The virtual memory address of the compiled code being unloaded. An op_write_native_code() with the same vma should have occurred before this call.

Returns 0 on success; -1 otherwise. If -1 is returned, errno is set to indicate the nature of the error.

Definition at line 355 of file opagent.c.

References jr_code_unload::id, JIT_CODE_UNLOAD, jr_code_unload::timestamp, jr_code_unload::total_size, and jr_code_unload::vma.

Referenced by cb_compiled_method_unload(), and compiled_method_unload().

Here is the caller graph for this function:

int op_write_debug_line_info ( op_agent_t  hdl,
void const *  code,
size_t  nr_entry,
struct debug_line_info const *  compile_map 
)

Add debug line information to a piece of code. An op_write_native_code() with the same code pointer should have occurred before this call. It's not necessary to provide one lineno information entry per machine instruction; the array can contain hole.

hdl: Handle returned from an earlier call to op_open_agent() code: Pointer to the location of the code with debug info nr_entry: Number of entries in compile_map compile_map: Array of struct debug_line_info. See the JVMTI agent library implementation for an example of what information should be retrieved from a VM to fill out this data structure.

Returns 0 on success; -1 otherwise. If -1 is returned, errno is set to indicate the nature of the error.

Definition at line 279 of file opagent.c.

References jr_code_debug_info::code_addr, error(), filename, jr_code_debug_info::id, JIT_CODE_DEBUG_INFO, jr_code_debug_info::nr_entry, PADDING_8ALIGNED, jr_code_debug_info::timestamp, and jr_code_debug_info::total_size.

Referenced by cb_compiled_method_load().

Here is the call graph for this function:

Here is the caller graph for this function:

int op_write_native_code ( op_agent_t  hdl,
char const *  symbol_name,
uint64_t  vma,
void const *  code,
const unsigned int  code_size 
)

Signal the dynamic generation of native code from a virtual machine. Writes a JIT dump record to the open JIT dump file using the passed information.

hdl: Handle returned from an earlier call to op_open_agent() symbol_name: The name of the symbol being dynamically compiled. This name can (and should) contain all necessary information to disambiguate it from symbols of the same name; e.g., class, method signature. vma: The virtual memory address of the executable code. code: Pointer to the location of the compiled code. Theoretically, this may be a different location from that given by the vma argument. For some JIT compilers, obtaining the code may be impractical. For this (or any other) reason, the agent can choose to pass NULL for this paraemter. If NULL is passed, no code will be copied into the JIT dump file. code_size: Size of the compiled code.

Returns 0 on success; -1 otherwise. If -1 is returned, errno is set to indicate the nature of the error.

Definition at line 222 of file opagent.c.

References jr_code_load::code_addr, jr_code_load::code_size, jr_code_load::id, JIT_CODE_LOAD, PADDING_8ALIGNED, jr_code_load::timestamp, jr_code_load::total_size, and jr_code_load::vma.

Referenced by cb_compiled_method_load(), cb_dynamic_code_generated(), and compiled_method_load().

Here is the caller graph for this function:


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1