[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Qemu-devel] Counting Instructions and Looking for ConditionalBranch
From: |
Torbjorn.K.Andersson |
Subject: |
RE: [Qemu-devel] Counting Instructions and Looking for ConditionalBranches |
Date: |
Mon, 19 Feb 2007 09:40:03 +0100 |
Hello Shane.
I have successfully added instruction counters to QEMU with a low run-time
overhead. I cannot give you the code but I can tell you how I did it.
1: Make sure that QEMU knows which block is the current_tb. What I did was to
update the goto_tb block to update the current_tb pointer.
2: Add an epilogue to the basic blocks that uses the current_tb pointer and
increase the instruction counter with the information stored in the current_tb.
In my test system it was a one to one mapping with the size of the TB.
The files you will need to update are: exec.c and translate.c together with
op.c for your target. Maybe more..
/Regards
Torbjörn Andersson
________________________________
From: address@hidden [mailto:address@hidden On Behalf Of Shane Brennan
Sent: den 18 februari 2007 03:08
To: address@hidden
Subject: [Qemu-devel] Counting Instructions and Looking for ConditionalBranches
I am wondering if anyone knows where in the QEMU source code I can create a
counter to count the number of executed instructions? In addition, where I can
place an IF statement to see if a conditional branch instruction is about to
execute.
I need to do this to create a basic block vector for SimPoint. I have found
that the function cpu-exec in cpu-exec.c is probably going to be involved, but
I would appreciate any help in narrowing things down. Basically, all I need to
do is at every instruction I increase a counter. Then, I see if that
instruction is a conditional branch. If it is, I print some characters to a
file, and reset the counter. I would greatly appreciate any help.
~Shane