From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHOIn-0007fM-9C for qemu-devel@nongnu.org; Wed, 04 Sep 2013 21:24:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHOIh-0005J6-9i for qemu-devel@nongnu.org; Wed, 04 Sep 2013 21:24:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHOIh-0005J0-1R for qemu-devel@nongnu.org; Wed, 04 Sep 2013 21:23:59 -0400 Message-ID: <5227DDC1.4000401@redhat.com> Date: Thu, 05 Sep 2013 03:26:25 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <521F4E76.2090507@redhat.com> <1377783470-8981-2-git-send-email-lersek@redhat.com> <20130904142105.GD12733@stefanha-thinkpad.redhat.com> In-Reply-To: <20130904142105.GD12733@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] add some virtio-scsi trace events List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: pbonzini@redhat.com, qemu-devel@nongnu.org On 09/04/13 16:21, Stefan Hajnoczi wrote: > On Thu, Aug 29, 2013 at 03:37:50PM +0200, Laszlo Ersek wrote: >> +static void dump_cmd_req(const VirtIOSCSIReq *req, uint32_t cdb_size) >> +{ >> + const VirtIOSCSICmdReq *cr; >> + char *cdb_hex; >> + >> + if (!trace_event_get_state(TRACE_VIRTIO_SCSI_DUMP_CMD_REQ)) { >> + return; >> + } >> + cr = req->req.cmd; >> + cdb_hex = qemu_hexstr(cr->cdb, cdb_size, NULL); >> + trace_virtio_scsi_dump_cmd_req((void *)req, cr->tag, >> + virtio_scsi_get_lun((uint8_t *)cr->lun), >> + cdb_hex); >> + g_free(cdb_hex); > > There is a halfway solution to disable expensive trace events that works > across all backends (SystemTap, stderr, etc): > > if (!TRACE_VIRTIO_SCSI_DUMP_CMD_REQ_ENABLED) { > return; > } > > This is a compile-time constant which can be toggled with the "disable" > keyword in the ./trace-events file: > > disable my_expensive_event(const char *foo) "foo %s" > > See the bottom of docs/tracing.txt for full documentation on the > "disable" keyword. Yes, I've read it :) The compile-time constant is already used (just not in an if() but in a surrounding #if, snipped from the context above), and the corresponding tracepoints are already disabled in ./trace-events. I do read documentation if it exists. I guess I'll rework this sometime later. Thanks, Laszlo