From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHDxO-0000q3-Ue for qemu-devel@nongnu.org; Wed, 04 Sep 2013 10:21:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHDxF-0007Z7-Pe for qemu-devel@nongnu.org; Wed, 04 Sep 2013 10:21:18 -0400 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]:32811) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHDxF-0007Yw-JQ for qemu-devel@nongnu.org; Wed, 04 Sep 2013 10:21:09 -0400 Received: by mail-ee0-f43.google.com with SMTP id e52so218021eek.30 for ; Wed, 04 Sep 2013 07:21:08 -0700 (PDT) Date: Wed, 4 Sep 2013 16:21:05 +0200 From: Stefan Hajnoczi Message-ID: <20130904142105.GD12733@stefanha-thinkpad.redhat.com> References: <521F4E76.2090507@redhat.com> <1377783470-8981-2-git-send-email-lersek@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1377783470-8981-2-git-send-email-lersek@redhat.com> 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: Laszlo Ersek Cc: pbonzini@redhat.com, qemu-devel@nongnu.org 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. Stefan