Apache Harmony is retired at the Apache Software Foundation since Nov 16, 2011.

The information on these pages may be out of date, or may refer to resources that have moved or have been made read-only.
For more information please refer to the Apache Attic

Jitrino.OPT Internal Profiler Tool

  1. About This Document
  2. Overview
  3. Configuring the Profiler
    1. Available Global Parameters
    2. Counters
    3. Re-using Filter Parameters between Counters
  4. Dumping of Counters
  5. Example of iprof Configuration File
  6. Example of Profiler Output

About This Document

This document defines the internal profiler tool (iprof) for Jitrino.OPT code generator and describes how to use it.

Overview

The internal profiler can instrument code so that per-method counters of executed (not just compiled) instructions can be dumped. Operation of iprof is configured in the iprof.cfg file, as described in this document. For sample iprof tool output, see theexample.

To enable iprof, do the following:

  1. Specify the following command-line option to DRLVM on startup:
    -XDjit.arg.codegen.iprof=on
  2. Place the configuration file iprof.cfg in the same directory where you are starting DRLVM.

Configuring the Profiler

The configuration file iprof.cfg consists of a list of global parameters and a list of counters, as defined in this section. For a sample iprof configuration, see the example.

Available Global Parameters

Config.PrintBBStats=false #(boolean)

This parameter turns on statistics dumping for all basic blocks of a method.

Counters

Counters collect information about executed instructions defined by the filter. Counters have the following attributes:

Example

###########
[begin]
Counter.CALL.Mnemonic=CALL
[end]
 
[begin]
Counter.AddCounter.Title=ADD_EAX_COUNTER
Counter.AddCounter.Mnemonic=ADD
Counter.AddCounter.Operand.0.RegName=EAX
[end]
###########

All properties of an instruction correspond to names of entities of the Jitrino IA-32 code generator, for example:

Mnemonic_CALL => CALL
OpndKind_Mem => Mem
Operand attributes
Operand.OpNum Operand number (can be *)
Operand.OpNum.OpndRole Operand role
Operand.OpNum.OpndKind Operand kind
Operand.OpNum.RegName Register name
Operand.OpNum.MemOpndKind Memory operand kind
Instruction attributes
Mnemonic Instruction mnemonic
OperandNumber Number of operands
Run-time information attributes
RuntimeInfo.Kind Runtime information kind
RuntimeInfo.HelperID VM Helper identifier
RuntimeInfo.IntHelperName Internal helper name
Call instruction attributes
isNative
isStatic
isSynchronized
isNoInlining
isInstance
isFinal
isVirtual
isAbstract
isClassInitializer
isInstanceInitializer
isStrict
isRequireSecObject
isInitLocals
isOverridden

The counter does not work for other instructions.

Re-using Filter Parameters between Counters

Filter parameters of a counter can be re-used and extended by another counter, for example:

[begin]
Counter.CALL_Inst.Mnemonic=CALL
[end]
[begin]
Counter.I_HELPER_CALL=CALL_Inst
Counter.I_HELPER_CALL.RuntimeInfo.Kind=InternalHelperAddress
[end]

Warning

Space Characters should not be used outside comments.

Dumping of Counters

The iprof tool creates the file iprof.stat on exit of a DRLVM session in the directory where DRLVM was started. Tabbed text format can be edited by spreadsheets.

Example of iprof Configuration File

This is an example of the Jitrino.OPT internal profiler configuration.

Config.PrintBBStats=true
[begin]
#for counting of all instructions you can specify any word as Mnemonic
Counter.Insts.Mnemonic=Any
[end]
 
#hardcoded counters with only parameter "title"
###############################################
[begin]
#Size of java bytecode of a method
Counter.ByteCodeSize
[end]
#
[begin]
#Number of execution times of the hottest basic block of a method
Counter.MaxBBExec
[end]
[begin]
##ID nuber of the hottest basic block
Counter.HottestBBNum
[end]
#
[begin]
##Number of exception handlers of a method
Counter.ExcHandlersNum
[end]
#
[begin]
#Number of calls of a method
Counter.MethodExec
Counter.MethodExec.Title=Number of calls of a method
[end]
#
[begin]
#Basic block execution count
Counter.BBExec
[end]
################################################
[begin]
Counter.OpNum.OpndNumber=3
[end]
[begin]
#count instructions with memory access in first five operands
Counter.MemOpnd.IsOR=true
Counter.MemOpnd.Operand.*.OpndKind=Mem
#Counter.MemOpnd.Operand.1.OpndKind=Mem
[end]
[begin]
Counter.UseOpnd.Operand.0.OpndRole=Use
[end]
[begin]
Counter.EAXOpnd.Operand.0.RegName=EAX
[end]
[begin]
Counter.HeapOpnd.Operand.0.MemOpndKind=Heap
[end]
[begin]
Counter.Method.isNative=true
Counter.Method.isStatic=true
Counter.Method.isSynchronized=true
Counter.Method.isNoInlining=true
Counter.Method.isInstance=true
Counter.Method.isFinal=true
Counter.Method.isVirtual=true
Counter.Method.isAbstract=true
Counter.Method.isClassInitializer=true
Counter.Method.isInstanceInitializer=true
Counter.Method.isStrict=true
Counter.Method.isRequireSecObject=true
Counter.Method.isInitLocals=true
Counter.Method.isOverridden=true
[end]
 
[begin]
Counter.CALL.Mnemonic=CALL
[end]
[begin]
Counter.I_HELPER_CALL=CALL
Counter.I_HELPER_CALL.RuntimeInfo.Kind=InternalHelperAddress
[end]
[begin]
Counter.HELPER_CALL=CALL
Counter.HELPER_CALL.RuntimeInfo.Kind=HelperAddress
Counter.HELPER_CALL.RuntimeInfo.HelperID=LdString
[end]

Example of Profiler Output

This is a fragment of a sample stat file that iprof produces.

Method name	Insts	ByteCodeSize	MaxBBExec	HottestBBNum	ExcHandlersNum	Number of calls of a method	BBExec	CALL	I_HELPER_CALL	HELPER_CALL	LDSTRING	NEWOBJ_USINGVTABLE	NEWVECTOR_USINGVTABLE	NEWOBJ	NEWVECTOR	NEWMULTIARRAY	OBJMONITORENTER	ObjMonitorExit	TYPEMONITORENTER	TYPEMONITOREXIT	THROW_KEEPSTACKTRACE	THROW_SETSTACKTRACE	THROW_LAZY	NULLPTREXCEPTION	ARRAYBOUNDSEXCEPTION	ELEMTYPEEXCEPTION	DIVIDEBYZEROEXCEPTION	THROW_LINKINGEXCEPTION	DIVI32	DIVU32	DIVI64	DIVU64	DIVSINGLE	DIVDOUBLE	REMI32	REMU32	REMI64	REMU64	REMSINGLE	RemDouble	MulI64	ShlI64	ShrI64	ShruI64	ConvStoI32	ConvStoI64	ConvDtoI32	ConvDtoI64	LdInterface	Cast	IsInstanceOf	InitType	IsValidElemType	CharArrayCopy	MANAGE_CALL	MemOpnd	Method	
java/lang/Thread.<clinit>	7	13	1	2	0	1	1	1	0	1	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	1	0	0	0	4	0	
java/lang/Object.<init>	6445	1	6445	2	0	6444	6445	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	
java/lang/Thread.<init>	2440	257	24	0	0	24	284	280	0	79	26	3	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	50	0	0	129	800	48	

Back to top