Received: from eggs.gnu.org ([208.118.235.92]:52763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SemvN-00079Z-62 for qemu-devel@nongnu.org; Wed, 13 Jun 2012 08:43:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SemvG-0004xW-JV for qemu-devel@nongnu.org; Wed, 13 Jun 2012 08:43:48 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:45051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SemvG-0004xL-9A for qemu-devel@nongnu.org; Wed, 13 Jun 2012 08:43:42 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <20120613031426.GA8174@cs.nctu.edu.tw> Date: Wed, 13 Jun 2012 15:43:32 +0300 In-Reply-To: (Stefan Hajnoczi's message of "Wed, 13 Jun 2012 10:18:41 +0100") Message-ID: <871uljmlfv.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] How to measure guest memory access (qemu_ld/qemu_st) time? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Stefan Hajnoczi writes: > On Wed, Jun 13, 2012 at 4:14 AM, =E9=99=B3=E9=9F=8B=E4=BB=BB (Wei-Ren Che= n) > wrote: >> =C2=A0I suspect that guest memory access (qemu_ld/qemu_st) account for t= he major of >> time spent in system mode. I would like to know precisely how much (if p= ossible). >> We use tools like perf [1] before, but since the logic of guest memory a= ccess aslo >> embedded in the host binary not only helper functions, the result cannot= be >> relied. The current idea is adding helper functions before/after guest m= emory >> access logic. Take ARM guest on x86_64 host for example, should I add th= e helper >> functions before/after tcg_gen_qemu_{ld,st} in target-arm/translate.c or >> tcg_out_qemu_{ld,st} in tcg/i386/tcg-target.c? Or there is a better way = to know >> how much time QEMU spend on handling guest memory access? > Llu=C3=ADs: Can the instrumentation you've been working on do this? Sure. I have tracepoints for memory accesses before they are actually performed. It would just be a matter of adding another tracepoint after the memory access operation has been performed (I had plans for adding this tog= ether with physical memory address information, but I'm on other tasks for the ti= me being). Given that memory access tracepoints are added through macros (by redefinin= g the memory access routine), it's trivial to add a tracepoint after the memory a= ccess itself. Unfortunately, I had the bad idea of rebasing all my series on top of the l= atest makefile changes, and I'll have to go through each patch to check it's still working (I'm sure some of them broke). Lluis --=20 "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth