From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTUiK-0008Dl-Ut for qemu-devel@nongnu.org; Fri, 28 Mar 2014 07:12:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTUiG-0000aC-F1 for qemu-devel@nongnu.org; Fri, 28 Mar 2014 07:12:44 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:55594 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTUiG-0000Yb-7v for qemu-devel@nongnu.org; Fri, 28 Mar 2014 07:12:40 -0400 References: <1395938253-9225-1-git-send-email-alex.bennee@linaro.org> <53348143.5060902@twiddle.net> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <53348143.5060902@twiddle.net> Date: Fri, 28 Mar 2014 11:12:55 +0000 Message-ID: <87ppl6vao8.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC PATCH] tcg: add ability to dump /tmp/perf-.map files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Yeongkyoon Lee , qemu-devel@nongnu.org, Alexander Graf , Kirill Batuzov , Blue Swirl , Stefan Weil , Anthony Liguori , Amit Shah , Matthew Fernandez Richard Henderson writes: > On 03/27/2014 09:37 AM, alex.bennee@linaro.org wrote: >> From: Alex Bennée >> >> This allows the perf tool to map samples to each individual translation >> block. This could be expanded for user space but currently it gives >> enough information to find any hotblocks by other means. > > Plausible, I suppose. It works fine on my toy test case (kernel + single computation user-space /init task) but I've not really used it in anger for any performance tweaking hence it's only an RFC patch. Hopefully it will save re-inventing the wheel should anyone actually want to do serious tcg optimisation. I've had a brief poke around the TCG profiling and seen it track generation cost. Do we have any hotblock tracking in the built-in profiler? >> +static void tcg_write_perfmap(uint8_t *start, uint64_t size, uint64_t target_pc) >> +{ >> + if (tcg_perfmap) { >> + g_fprintf(tcg_perfmap, "%lx %lx subject-0x%lx\n", >> + (uint64_t) start, size, target_pc); >> + } >> +} > > Why oh why do you feel the need to use g_fprintf? That's just gratuitous glib > obfuscation, that. Sorry my bad, force of habit given that we have glib as a dependency. But your right in this case it's just a dumb wrapper unlike when your doing more string mangling where glib save a lot of time. > For this small of a single-use function, I think it would be clearer to just do > the printf directly in tcg_gen_code_common. Certainly no need to use uint64_t > all over the place; ptrdiff_t and target_ulong are exactly the right > thing. Do we have a format macro for target_ulong? The uint64_t was just for simplicity. I found when I was messing with the trace-event stuff some of the target types where barred from the common code although I guess in this case the tcg is very aware of the execution target. -- Alex Bennée