qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] add some virtio-scsi trace events


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 2/2] add some virtio-scsi trace events
Date: Wed, 4 Sep 2013 16:21:05 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]