From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LhMsU-0002I4-Fx for qemu-devel@nongnu.org; Wed, 11 Mar 2009 07:45:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LhMsQ-0002Fe-9c for qemu-devel@nongnu.org; Wed, 11 Mar 2009 07:45:35 -0400 Received: from [199.232.76.173] (port=52671 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LhMsP-0002F6-K3 for qemu-devel@nongnu.org; Wed, 11 Mar 2009 07:45:33 -0400 Received: from main.gmane.org ([80.91.229.2]:55627 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LhMsP-0001Eh-5A for qemu-devel@nongnu.org; Wed, 11 Mar 2009 07:45:33 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LhMsI-00056l-0T for qemu-devel@nongnu.org; Wed, 11 Mar 2009 11:45:26 +0000 Received: from 141.76.6.219 ([141.76.6.219]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 11 Mar 2009 11:45:26 +0000 Received: from usenet by 141.76.6.219 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 11 Mar 2009 11:45:26 +0000 From: Steffen Liebergeld Date: Wed, 11 Mar 2009 11:45:15 +0000 (UTC) Message-ID: References: <200903100155.22875.paul@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: news Subject: [Qemu-devel] Re: Precise guest instruction count. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, Paul Brook schrieb: >> So my question is how can I get accurate guest instruction count number? > > -icount maintains an accurate count of the number of instructions executed. > However for performance reasons the counter value is not valid at all times. > Also note that you can not assume that a whole TB is executed (because of MMU > faults, or IO interrupts). > Even with -icount, qemu is only deterministic internally. Its behavior can > still be influenced by external events. In usermode this could be any > syscall. In system mode this could be mouse/keyboard input, modified disk > images or network traffic (possibly other things I've missed). I am using system mode exclusively. > If you need counts of specific instructions then you probably need to add > explicit counters to the implementation of those instructions. I disabled all timers in Qemu and run a guest program, which includes an assembly-coded loop. At the start and end of the loop I have a magic instruction, upon which Qemu prints the current output of cpu_get_clock. I run qemu with the flag -icount 0. Still, the delta of those two values does not in any kind resemble the amount of instructions, and worse it is not constant with subsequent runs. Can you give any suggestions on how to get a precise absolut guest instruction count? Greetings, Steffen