On the 0x213 day of Apache Harmony Armand Navabi wrote: > Egor mentioned that for profiling at the machine code level there is a > profiling utility ("iprof"). How does one use this profiling tool? Is > there command line options to run with profiling and if so what are the > options and how do I get to the collected information after running a > profiled application?
Armand, "iprof" is the Internal PROFiler in the IA-32 CG (Jitrino.OPT only). It is able to instrument the code in such way that per-method counters of _executed_ (not just compiled) instructions can be dumped. "iprof" creates the file "iprof.stat" (on exit) with various statistics per method (compiled by OPT). For example, "number of calls executed", "most executed basic block number", "number of casts", etc. see the sample of iprof.cfg below. To use it you need to: * put iprof.cfg in the same dir where you are starting DRLVM * put extra options: -Djit.arg.codegen.iprof=on -XcleanupOnExit * find the "iprof.stat" created :) On a simple HelloWorld only 2 methods are compiled by OPT in default mode. So, the iprof.stat is short. See more details in -Xem:opt mode) we will document "iprof" in more detail... Nadya, is it on the way or not yet? :) ------------------- <begin iprof.cfg> ------------ #Use [begin]/[end] tags for EACH counter #Don't use "space" character outside comments. This restriction should be removed #Config.PrintBBStats=true [begin] #for counting of all instructions you can specify any word as Mnemonic Counter.Insts.Mnemonic=Any [end] [begin] Counter.NULLPTREXCEPTION=HELPER_CALL Counter.NULLPTREXCEPTION.RuntimeInfo.HelperID=NullPtrException [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] ############################################### #Other counters [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] [begin] Counter.LDSTRING=HELPER_CALL Counter.LDSTRING.RuntimeInfo.HelperID=LdString [end] [begin] Counter.NEWOBJ_USINGVTABLE=HELPER_CALL Counter.NEWOBJ_USINGVTABLE.RuntimeInfo.HelperID=NewObj_UsingVtable [end] [begin] Counter.NEWVECTOR_USINGVTABLE=HELPER_CALL Counter.NEWVECTOR_USINGVTABLE.RuntimeInfo.HelperID=NewVector_UsingVtable [end] [begin] Counter.NEWOBJ=HELPER_CALL Counter.NEWOBJ.RuntimeInfo.HelperID=NewObj [end] [begin] Counter.NEWVECTOR=HELPER_CALL Counter.NEWVECTOR.RuntimeInfo.HelperID=NewVector [end] [begin] Counter.NEWMULTIARRAY=HELPER_CALL Counter.NEWMULTIARRAY.RuntimeInfo.HelperID=NewMultiArray [end] [begin] Counter.OBJMONITORENTER=HELPER_CALL Counter.OBJMONITORENTER.RuntimeInfo.HelperID=ObjMonitorEnter [end] [begin] Counter.ObjMonitorExit=HELPER_CALL Counter.ObjMonitorExit.RuntimeInfo.HelperID=ObjMonitorExit [end] [begin] Counter.TYPEMONITORENTER=HELPER_CALL Counter.TYPEMONITORENTER.RuntimeInfo.HelperID=TypeMonitorEnter [end] [begin] Counter.TYPEMONITOREXIT=HELPER_CALL Counter.TYPEMONITOREXIT.RuntimeInfo.HelperID=TypeMonitorExit [end] [begin] Counter.THROW_KEEPSTACKTRACE=HELPER_CALL Counter.THROW_KEEPSTACKTRACE.RuntimeInfo.HelperID=Throw_KeepStackTrace [end] [begin] Counter.THROW_SETSTACKTRACE=HELPER_CALL Counter.THROW_SETSTACKTRACE.RuntimeInfo.HelperID=Throw_SetStackTrace [end] [begin] Counter.THROW_LAZY=HELPER_CALL Counter.THROW_LAZY.RuntimeInfo.HelperID=Throw_Lazy [end] [begin] Counter.ARRAYBOUNDSEXCEPTION=HELPER_CALL Counter.ARRAYBOUNDSEXCEPTION.RuntimeInfo.HelperID=ArrayBoundsException [end] [begin] Counter.ELEMTYPEEXCEPTION=HELPER_CALL Counter.ELEMTYPEEXCEPTION.RuntimeInfo.HelperID=ElemTypeException [end] [begin] Counter.DIVIDEBYZEROEXCEPTION=HELPER_CALL Counter.DIVIDEBYZEROEXCEPTION.RuntimeInfo.HelperID=DivideByZeroException [end] [begin] Counter.THROW_LINKINGEXCEPTION=HELPER_CALL Counter.THROW_LINKINGEXCEPTION.RuntimeInfo.HelperID=Throw_LinkingException [end] [begin] Counter.DIVI32=HELPER_CALL Counter.DIVI32.RuntimeInfo.HelperID=DivI32 [end] [begin] Counter.DIVU32=HELPER_CALL Counter.DIVU32.RuntimeInfo.HelperID=DivU32 [end] [begin] Counter.DIVI64=HELPER_CALL Counter.DIVI64.RuntimeInfo.HelperID=DivI64 [end] [begin] Counter.DIVU64=HELPER_CALL Counter.DIVU64.RuntimeInfo.HelperID=DivU64 [end] [begin] Counter.DIVSINGLE=HELPER_CALL Counter.DIVSINGLE.RuntimeInfo.HelperID=DivSingle [end] [begin] Counter.DIVDOUBLE=HELPER_CALL Counter.DIVDOUBLE.RuntimeInfo.HelperID=DivDouble [end] [begin] Counter.REMI32=HELPER_CALL Counter.REMI32.RuntimeInfo.HelperID=RemI32 [end] [begin] Counter.REMU32=HELPER_CALL Counter.REMU32.RuntimeInfo.HelperID=RemU32 [end] [begin] Counter.REMI64=HELPER_CALL Counter.REMI64.RuntimeInfo.HelperID=RemI64 [end] [begin] Counter.REMU64=HELPER_CALL Counter.REMU64.RuntimeInfo.HelperID=RemU64 [end] [begin] Counter.REMSINGLE=HELPER_CALL Counter.REMSINGLE.RuntimeInfo.HelperID=RemSingle [end] [begin] Counter.RemDouble=HELPER_CALL Counter.RemDouble.RuntimeInfo.HelperID=RemDouble [end] [begin] Counter.MulI64=HELPER_CALL Counter.MulI64.RuntimeInfo.HelperID=MulI64 [end] [begin] Counter.ShlI64=HELPER_CALL Counter.ShlI64.RuntimeInfo.HelperID=ShlI64 [end] [begin] Counter.ShrI64=HELPER_CALL Counter.ShrI64.RuntimeInfo.HelperID=ShrI64 [end] [begin] Counter.ShruI64=HELPER_CALL Counter.ShruI64.RuntimeInfo.HelperID=ShruI64 [end] [begin] Counter.ConvStoI32=HELPER_CALL Counter.ConvStoI32.RuntimeInfo.HelperID=ConvStoI32 [end] [begin] Counter.ConvStoI64=HELPER_CALL Counter.ConvStoI64.RuntimeInfo.HelperID=ConvStoI64 [end] [begin] Counter.ConvDtoI32=HELPER_CALL Counter.ConvDtoI32.RuntimeInfo.HelperID=ConvDtoI32 [end] [begin] Counter.ConvDtoI64=HELPER_CALL Counter.ConvDtoI64.RuntimeInfo.HelperID=ConvDtoI64 [end] [begin] Counter.LdInterface=HELPER_CALL Counter.LdInterface.RuntimeInfo.HelperID=LdInterface [end] [begin] Counter.Cast=HELPER_CALL Counter.Cast.RuntimeInfo.HelperID=Cast [end] [begin] Counter.IsInstanceOf=HELPER_CALL Counter.IsInstanceOf.RuntimeInfo.HelperID=IsInstanceOf [end] [begin] Counter.InitType=HELPER_CALL Counter.InitType.RuntimeInfo.HelperID=InitType [end] [begin] Counter.IsValidElemType=HELPER_CALL Counter.IsValidElemType.RuntimeInfo.HelperID=IsValidElemType [end] [begin] Counter.CharArrayCopy=HELPER_CALL Counter.CharArrayCopy.RuntimeInfo.HelperID=CharArrayCopy [end] [begin] Counter.MANAGE_CALL=CALL Counter.MANAGE_CALL.isNative=false [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 #Counter.MemOpnd.Operand.2.OpndKind=Mem #Counter.MemOpnd.Operand.3.OpndKind=Mem #Counter.MemOpnd.Operand.4.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] ------------------- <end iprof.cfg> ------------ -- Egor Pasko, Intel Managed Runtime Division