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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shane Brennan Sent: den 18 februari 2007 03:08 To: qemu-devel@nongnu.org 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 _______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel