opagent.h File Reference

Interface to report symbol names and dynamically generated code to Oprofile. More...

#include <sys/types.h>
#include <stdint.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.

Classes

struct  debug_line_info

Typedefs

typedef void * op_agent_t

Functions

op_agent_t op_open_agent (void)
 This function must be called by agents before any other function.
int op_close_agent (op_agent_t hdl)
 Frees all resources and closes open file handles.
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.
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.
int op_unload_native_code (op_agent_t hdl, uint64_t vma)
 Signal the invalidation of native code from a virtual machine.
int op_major_version (void)
 Returns the major version number of the libopagent library that will be used.
int op_minor_version (void)
 Returns the minor version number of the libopagent library that will be used.

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


Typedef Documentation

typedef void* op_agent_t

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.

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().

int op_major_version ( void   ) 

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

References OP_MAJOR_VERSION.

Referenced by Agent_OnLoad(), and JVM_OnLoad().

int op_minor_version ( void   ) 

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

References OP_MINOR_VERSION.

Referenced by Agent_OnLoad(), and JVM_OnLoad().

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 /tmp/.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.

References jitheader::bfd_arch, jitheader::bfd_mach, create_dir(), JITDUMP_DIR, JITHEADER_MAGIC, JITHEADER_VERSION, jitheader::magic, PADDING_8ALIGNED, jitheader::timestamp, TMP_OPROFILE_DIR, jitheader::totalsize, and jitheader::version.

Referenced by Agent_OnLoad(), and JVM_OnLoad().

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.

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

Referenced by compiled_method_unload().

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.

References jr_code_debug_info::code_addr, error(), 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.

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.

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 compiled_method_load().


Generated on 29 Jul 2013 for oprofile by  doxygen 1.6.1