We have instrumented the i386 JIT translator to perform time measurements similar to what you are interested in doing. We have incorporated this into the Kaffe snap shot from June 15, 1999. I think that you want to avoid instrumenting the trampoline. Our approach modified the prologue and epilogue code generation in jit-i386.def. The instrumentation generate inline machine code to read the pentium timestamp register and the cost is on the order of 10 instruction for the method. A count of the number of times a method is entered is also maintained. The measurement information is stored in fields added to the Method structure. We also have time measurements around each call in the generated method, so we can compute the amount of time spent in the children of the method and the time spend in the method itself. The advantage of this approach are: -Provides pretty high time resolution measurements -Avoids the overhead of function calls -Allows instrumentation of all methods executed The disadvantages of this approach are: -Doesn't handle the multithread code -Needs to be ported to each new processor architecture -Will Cohen > > > We are trying to instrument the timing of the execution of compiled code > in each method. > > Is it possible to insert timing functions to measure the time of compiled code. > Currently, the instruction " mov %g1,%i7 \n" makes it difficult to > achieve this (routine never returns after the jmp call to compiled codei (%o0)) > > asm( > START_ASM_FUNC() C_FUNC_NAME(sparc_do_fixup_trampoline) "\n" > C_FUNC_NAME(sparc_do_fixup_trampoline) ": \n > add %sp,-8,%sp \n > st %g1, [%sp+4] \n > save %sp,-64,%sp \n > ld [%i7+8],%o0 \n > call " C_FUNC_NAME(fixupTrampoline) " \n > mov %g1,%i7 \n > => BEGIN TIMING FUNCTION > jmp %o0 \n > => END TIMING FUNCTION > restore \n > nop " > END_ASM_FUNC() > ); > > We are running this on a Solaris 2.6 platform > > >