timestamp - time of executing block in qemu -
i want ask question getting time information when executing translation block in qemu
in fact im using function
qemu_clock_get_ns(qemu_clock_virtual);
but i'm not sure returns time of executing translation block in guest processor.
so can give me hints ?
thanx
non kvm, soft-mmu qemu !!!:
qemu_clock_get_ns(qemuclocktype type) represent elapsed nano-seconds specified qemu reference clock. there several reference clocks: realtime, virtual, host, etc. qemu_clock_virtual counter explicitly driven qemu main loop: 1 tick of clock emulated quantum of time (nano-second).
details: qemu assume that:
1 guest instruction counter tick = 1 emulated nano second << icount_time_shift
icount_time_shift specfied "-icount" comand line option, 3 default.
all qemu timers implemented deadlines (in qemu_clock_virtual units), , qemu execute translation blocks 1 deadline another. straight conversation ns icount provide deteremenistic tb generation: qemu main loop advance clock accordance num of instructions executed @ translation block/chain (see cpu_exec.c, here abstract pseudo code):
cpu_exec(cpustate env): # jump here if synchronous exception occurs: page fault, protection , etc if(setjmp(env) == exeption) ;#fall through for(;;): # if exception/interrupt pending handle here take_exception_or_interrupt(); while(no_interrupts()) { # num instructions left till next deadline icount_extra = get_icount_limit(); # find/generate tb accordnace icount_extra # every instruction access io last instruction @ block. # if access io cause interrupt handle on next iteration tb = find_tb(env, icount_extra); # execute tb or tb chain execute(env, tb); # increment qemu_clock_virtual accordance guest instructions executed # (syncronise iothread) update_clock(tb.executed_instr); # take interrupts @ next iteration
intervals provided qemu_clock_virtual used @ models of guest timers/counters: example if set board system counter frequency 62 mhz, qemu single increment of counter per 16 increments of qemu_clock_virtual.
then can use qemu_clock_get_ns(qemu_clock_virtual) obtain emulated nano second intervals @ guest model.
Comments
Post a Comment