Received: from [140.186.70.92] (port=56431 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFSo2-0002Sz-Qo for qemu-devel@nongnu.org; Mon, 08 Nov 2010 09:34:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFSnv-0001AR-97 for qemu-devel@nongnu.org; Mon, 08 Nov 2010 09:34:41 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:33760 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PFSnu-00019r-UF for qemu-devel@nongnu.org; Mon, 08 Nov 2010 09:34:39 -0500 From: xscript@gmx.net (=?utf-8?Q?Llu=C3=ADs?=) Date: Mon, 08 Nov 2010 15:35:19 +0100 Message-ID: <87aalj51eg.fsf@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [RFC] tracing: per-CPU tracing state List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org As more and more tracing backends appear (right now: nop, simple, ust and the new dtrace), it is harder to provide a tracetool where these backends can be efficiently used without being aware of per-CPU tracing state. What I have now is basically: * trace.h : trace_##name Backend-specific declaration/definition of per-event tracing functions * trace-cpu.h : trace_cpu_##name Generic "static inline" definitions of functions that check the per-CPU state and (if true) call the corresponding trace_##name * trace-gen.h: trace_gen_##name Generic "static inline" definitions of functions that check the per-CPU state and (if true) generate TCG calls to a function redirecting the call to trace_##name The last two are only generated for those events that have the "gen" keyword in "trace-events". The point is that the trace_##name functions do an extra check (the one provided by the backend) that should not be necessary, as the per-CPU state check already ensures that the trace must be produced. Thus, I'd propose to provide an extra per-backend function that prodices the trace without checking the tracing state. Another important change would be to provide a generic interface inside QEMU that provides a programmatic control of the tracing state of all events (both per-cpu and global), and let each backend provide a small .c file implementing that functionality. This would provide a centralized point through QEMU monitor for the control of tracing events, plus any backend-specific control interface that might also be available. Lluis -- "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