* [Qemu-devel] Calling a function every N instructions or simulated cpu cycles
@ 2011-08-12 19:29 Adnan Khaleel
0 siblings, 0 replies; only message in thread
From: Adnan Khaleel @ 2011-08-12 19:29 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 843 bytes --]
I'm using Qemu along with a network simulator and I need to perform a synchronization every N cycles. What is the best way to do this in Qemu so that I can call a function periodically say every N instructions or simulated cpu cycles?
Currently I have a routine in main_loop() in vl.c but it seems like my synchronization routine is not called consistently. I'm showing the code snippet below to give you a better idea.
#define NETWORK_SYNC_CPU_CYCLES 100000
static void main_loop(void)
{
int r;
#ifdef NETWORK_COSIM
int check_counter = NETWORK_SYNC_CPU_CYCLES; //
#endif
qemu_main_loop_start();
for (;;) {
do {
bool nonblocking = false;
#ifdef NETWORK_COSIM
if (--check_counter == 0)
network_sync();
#endif
:
:
}
Thanks
Adnan
[-- Attachment #2: Type: text/html, Size: 1492 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-12 19:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12 19:29 [Qemu-devel] Calling a function every N instructions or simulated cpu cycles Adnan Khaleel
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).