From: "Adnan Khaleel" <adnan@khaleel.us>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Calling a function every N instructions or simulated cpu cycles
Date: Fri, 12 Aug 2011 14:29:05 -0500 [thread overview]
Message-ID: <20110812192905.0a118dba@shadowfax.no-ip.com> (raw)
[-- 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 --]
reply other threads:[~2011-08-12 19:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110812192905.0a118dba@shadowfax.no-ip.com \
--to=adnan@khaleel.us \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).