* [Qemu-devel] Counting Instructions and Looking for Conditional Branches
@ 2007-02-18 2:07 Shane Brennan
2007-02-19 8:40 ` [Qemu-devel] Counting Instructions and Looking for ConditionalBranches Torbjorn.K.Andersson
0 siblings, 1 reply; 2+ messages in thread
From: Shane Brennan @ 2007-02-18 2:07 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 695 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 744 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [Qemu-devel] Counting Instructions and Looking for ConditionalBranches
2007-02-18 2:07 [Qemu-devel] Counting Instructions and Looking for Conditional Branches Shane Brennan
@ 2007-02-19 8:40 ` Torbjorn.K.Andersson
0 siblings, 0 replies; 2+ messages in thread
From: Torbjorn.K.Andersson @ 2007-02-19 8:40 UTC (permalink / raw)
To: qemu-devel
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: qemu-devel-bounces+torbjorn.k.andersson=tietoenator.com@nongnu.org [mailto:qemu-devel-bounces+torbjorn.k.andersson=tietoenator.com@nongnu.org] 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-19 9:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-18 2:07 [Qemu-devel] Counting Instructions and Looking for Conditional Branches Shane Brennan
2007-02-19 8:40 ` [Qemu-devel] Counting Instructions and Looking for ConditionalBranches Torbjorn.K.Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).