From nobody Sun May 19 07:31:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608158520; cv=none; d=zohomail.com; s=zohoarc; b=XNmd0wDb/hW0Cnf1G4iDyoMnKzW/p8gD1FZy5/D7N5HFm9zN+8XQpk3X97cm3LU13wcky3QFpByKsIhaVdgZPqnNQDzqHtZ2WuTzfRc5H7a4/mLyGrb0vgPL4hzR/kRGy8xlLGrIr87KBbu0al1lDZdeV009EmT4ggOQ8Yx3zSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608158520; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eBTtdJa574Gz+I23wi2vOTukC40N79vjaWr4nXtBTFQ=; b=j8q+eaVfmGCCUWPGYtkWGyOitSo6MVMRa/U7seo1E6fsScrTqJ61xvj/sZcOjy56jZdDNsBL7OZPaiw9h+zuh1BMkOxKqKh6GwWPXSnbLfQBWh1ejgW6hzRj0iA1mjNd5ZDx2F7WntluTjIH645ChNF45fkik7v11DQ0+b78U0I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608158520283360.7900202239931; Wed, 16 Dec 2020 14:42:00 -0800 (PST) Received: from localhost ([::1]:52992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpZQu-0003YW-Te for importer@patchew.org; Wed, 16 Dec 2020 11:13:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpZMx-0007ym-TX for qemu-devel@nongnu.org; Wed, 16 Dec 2020 11:09:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kpZMw-0004ej-8H for qemu-devel@nongnu.org; Wed, 16 Dec 2020 11:09:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-w8IGefgJOgS6SWm52QHEqQ-1; Wed, 16 Dec 2020 11:09:35 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67FCA107ACFE; Wed, 16 Dec 2020 16:09:34 +0000 (UTC) Received: from localhost (ovpn-115-151.ams2.redhat.com [10.36.115.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id E681D18227; Wed, 16 Dec 2020 16:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608134977; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eBTtdJa574Gz+I23wi2vOTukC40N79vjaWr4nXtBTFQ=; b=DbENpSxijNfzK7gL/4SX5DcGEGhjkk3+myD9MqDaRnRdi1UFJowLsAJJJFr9Q965UqLlq/ ObQRjWYJ26tokJ47myXt5sXa6sbnZgP3ArAAeQMB0H+WCzLyr/0K8Z+PMjmAvLw/fhJz7d XFiTa0IyvfL9oAZvQB7UNxZpXK/hbZY= X-MC-Unique: w8IGefgJOgS6SWm52QHEqQ-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v2 1/3] trace: fix simpletrace doc mismerge Date: Wed, 16 Dec 2020 16:09:21 +0000 Message-Id: <20201216160923.722894-2-stefanha@redhat.com> In-Reply-To: <20201216160923.722894-1-stefanha@redhat.com> References: <20201216160923.722894-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The simpletrace documentation section was accidentally split when the ftrace section was introduced. Move the simpletrace-specific documentation back into the simpletrace section. Fixes: e64dd5efb2c6d522a3bc9d096cd49a4e53f0ae10 ("trace: document ftrace ba= ckend") Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- docs/devel/tracing.txt | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/devel/tracing.txt b/docs/devel/tracing.txt index d2160655b4..bf617ba976 100644 --- a/docs/devel/tracing.txt +++ b/docs/devel/tracing.txt @@ -218,6 +218,23 @@ source tree. It may not be as powerful as platform-sp= ecific or third-party trace backends but it is portable. This is the recommended trace backend unless you have specific needs for more advanced backends. =20 +=3D=3D=3D=3D Monitor commands =3D=3D=3D=3D + +* trace-file on|off|flush|set + Enable/disable/flush the trace file or set the trace file name. + +=3D=3D=3D=3D Analyzing trace files =3D=3D=3D=3D + +The "simple" backend produces binary trace files that can be formatted wit= h the +simpletrace.py script. The script takes the "trace-events-all" file and t= he +binary trace: + + ./scripts/simpletrace.py trace-events-all trace-12345 + +You must ensure that the same "trace-events-all" file was used to build QE= MU, +otherwise trace event declarations may have changed and output will not be +consistent. + =3D=3D=3D Ftrace =3D=3D=3D =20 The "ftrace" backend writes trace data to ftrace marker. This effectively @@ -246,23 +263,6 @@ NOTE: syslog may squash duplicate consecutive trace ev= ents and apply rate =20 Restriction: "syslog" backend is restricted to POSIX compliant OS. =20 -=3D=3D=3D=3D Monitor commands =3D=3D=3D=3D - -* trace-file on|off|flush|set - Enable/disable/flush the trace file or set the trace file name. - -=3D=3D=3D=3D Analyzing trace files =3D=3D=3D=3D - -The "simple" backend produces binary trace files that can be formatted wit= h the -simpletrace.py script. The script takes the "trace-events-all" file and t= he -binary trace: - - ./scripts/simpletrace.py trace-events-all trace-12345 - -You must ensure that the same "trace-events-all" file was used to build QE= MU, -otherwise trace event declarations may have changed and output will not be -consistent. - =3D=3D=3D LTTng Userspace Tracer =3D=3D=3D =20 The "ust" backend uses the LTTng Userspace Tracer library. There are no --=20 2.29.2 From nobody Sun May 19 07:31:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608158443; cv=none; d=zohomail.com; s=zohoarc; b=gSj5mIJHRE5vqkpTc9TyIOzX7E7U1NmcXtH82ZGYbBHHAeDvP+QKMidDIs1g7KCwTZEb4jy3H42u/oMX08m9uTNYvK2phpi5QtSyIY6rh5deXCkqpQhMnP0BO86s9JcgMD15RRSMly22fFtA9L465tlWfJQ3bT+E0ELHSSjAXeU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608158443; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VAFRRhFHQ0P8G3zRAkxweGOxxR62G/qeujXxMNbXzxM=; b=EQnBoFJh68JbwJPyY+E93lYCPBnRtZCrU2zryVDWavPzv9Ga/G3MKptjdBG+xtaAOABFtX5DB+qH8shd4UayvKxu280yzYq1Dye0QtgpdO+T5FU0VodXUPaFGeDhmlDn3NtGq79EIBT7rhnJ6RSZHdBM/KsDrnpmMSL6dJj2dDo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608158443817442.63721955175504; Wed, 16 Dec 2020 14:40:43 -0800 (PST) Received: from localhost ([::1]:48324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpZPK-0001e1-PO for importer@patchew.org; Wed, 16 Dec 2020 11:12:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpZN1-00084D-8r for qemu-devel@nongnu.org; Wed, 16 Dec 2020 11:09:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kpZMy-0004fI-RX for qemu-devel@nongnu.org; Wed, 16 Dec 2020 11:09:42 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-a2bUOxt-PNCEuWuvFy_1uw-1; Wed, 16 Dec 2020 11:09:37 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12992192202D; Wed, 16 Dec 2020 16:09:36 +0000 (UTC) Received: from localhost (ovpn-115-151.ams2.redhat.com [10.36.115.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85C4060C15; Wed, 16 Dec 2020 16:09:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608134980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VAFRRhFHQ0P8G3zRAkxweGOxxR62G/qeujXxMNbXzxM=; b=dJHyzQBggDIXjA7Y5ZiW2Bj3EoWAj5CkuTxXxnLDdbsVRtYQp/98fp0SQJARWrw8E8genG SiFsleivBJ3sKxHMOOYhRlnEAaI8e4GIhlksvRM6BfOeHTqb9ZhPkS+Z8r41UlWlfaTfO0 nQrVZkmDOP0AfIMTQRif7XBnA4sIDZs= X-MC-Unique: a2bUOxt-PNCEuWuvFy_1uw-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v2 2/3] tracing: convert documentation to rST Date: Wed, 16 Dec 2020 16:09:22 +0000 Message-Id: <20201216160923.722894-3-stefanha@redhat.com> In-Reply-To: <20201216160923.722894-1-stefanha@redhat.com> References: <20201216160923.722894-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This is a simple rST conversion of the documentation. Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi Reviewed-by: Alex Benn=C3=A9e --- docs/devel/index.rst | 1 + docs/devel/{tracing.txt =3D> tracing.rst} | 134 ++++++++++++++---------- 2 files changed, 81 insertions(+), 54 deletions(-) rename docs/devel/{tracing.txt =3D> tracing.rst} (89%) diff --git a/docs/devel/index.rst b/docs/devel/index.rst index f10ed77e4c..c3414c1d17 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -27,6 +27,7 @@ Contents: secure-coding-practices tcg tcg-icount + tracing multi-thread-tcg tcg-plugins bitops diff --git a/docs/devel/tracing.txt b/docs/devel/tracing.rst similarity index 89% rename from docs/devel/tracing.txt rename to docs/devel/tracing.rst index bf617ba976..76cc1b24fa 100644 --- a/docs/devel/tracing.txt +++ b/docs/devel/tracing.rst @@ -1,32 +1,38 @@ -=3D Tracing =3D +=3D=3D=3D=3D=3D=3D=3D +Tracing +=3D=3D=3D=3D=3D=3D=3D =20 -=3D=3D Introduction =3D=3D +Introduction +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 This document describes the tracing infrastructure in QEMU and how to use = it for debugging, profiling, and observing execution. =20 -=3D=3D Quickstart =3D=3D +Quickstart +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -1. Build with the 'simple' trace backend: +1. Build with the 'simple' trace backend:: =20 ./configure --enable-trace-backends=3Dsimple make =20 -2. Create a file with the events you want to trace: +2. Create a file with the events you want to trace:: =20 - echo memory_region_ops_read >/tmp/events + echo memory_region_ops_read >/tmp/events =20 -3. Run the virtual machine to produce a trace file: +3. Run the virtual machine to produce a trace file:: =20 qemu --trace events=3D/tmp/events ... # your normal QEMU invocation =20 -4. Pretty-print the binary trace file: +4. Pretty-print the binary trace file:: =20 ./scripts/simpletrace.py trace-events-all trace-* # Override * with QE= MU =20 -=3D=3D Trace events =3D=3D +Trace events +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -=3D=3D=3D Sub-directory setup =3D=3D=3D +Sub-directory setup +------------------- =20 Each directory in the source tree can declare a set of static trace events in a local "trace-events" file. All directories which contain "trace-event= s" @@ -50,7 +56,7 @@ In the sub-directory the following files will be automati= cally generated - trace-ust.h - UST event probe helper declarations =20 Source files in the sub-directory should #include the local 'trace.h' file, -without any sub-directory path prefix. eg io/channel-buffer.c would do +without any sub-directory path prefix. eg io/channel-buffer.c would do:: =20 #include "trace.h" =20 @@ -63,9 +69,10 @@ The top level directory generates trace files with a fil= ename prefix of "trace/trace-root" instead of just "trace". This is to avoid ambiguity bet= ween a trace.h in the current directory, vs the top level directory. =20 -=3D=3D=3D Using trace events =3D=3D=3D +Using trace events +------------------ =20 -Trace events are invoked directly from source code like this: +Trace events are invoked directly from source code like this:: =20 #include "trace.h" /* needed for trace event prototype */ =20 @@ -82,7 +89,8 @@ Trace events are invoked directly from source code like t= his: return ptr; } =20 -=3D=3D=3D Declaring trace events =3D=3D=3D +Declaring trace events +---------------------- =20 The "tracetool" script produces the trace.h header file which is included = by every source file that uses trace events. Since many source files include @@ -116,13 +124,14 @@ Format strings must not end with a newline character.= It is the responsibility of backends to adapt line ending for proper logging. =20 Each event declaration will start with the event name, then its arguments, -finally a format string for pretty-printing. For example: +finally a format string for pretty-printing. For example:: =20 qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p" qemu_vfree(void *ptr) "ptr %p" =20 =20 -=3D=3D=3D Hints for adding new trace events =3D=3D=3D +Hints for adding new trace events +--------------------------------- =20 1. Trace state changes in the code. Interesting points in the code usually involve a state change like starting, stopping, allocating, freeing. S= tate @@ -141,7 +150,8 @@ finally a format string for pretty-printing. For exampl= e: 4. Name trace events after their function. If there are multiple trace ev= ents in one function, append a unique distinguisher at the end of the name. =20 -=3D=3D Generic interface and monitor commands =3D=3D +Generic interface and monitor commands +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 You can programmatically query and control the state of trace events throu= gh a backend-agnostic interface provided by the header "trace/control.h". @@ -152,11 +162,11 @@ header "trace/control.h" to see which routines are ba= ckend-dependent). =20 The state of events can also be queried and modified through monitor comma= nds: =20 -* info trace-events +* ``info trace-events`` View available trace events and their state. State 1 means enabled, sta= te 0 means disabled. =20 -* trace-event NAME on|off +* ``trace-event NAME on|off`` Enable/disable a given trace event or a group of events (using wildcards= ). =20 The "--trace events=3D" command line argument can be used to enable = the @@ -170,11 +180,12 @@ to enable an entire family of events but one noisy ev= ent needs to be disabled. Wildcard matching is supported in both the monitor command "trace-event" a= nd the events list file. That means you can enable/disable the events having a co= mmon prefix in a batch. For example, virtio-blk trace events could be enabled u= sing -the following monitor command: +the following monitor command:: =20 trace-event virtio_blk_* on =20 -=3D=3D Trace backends =3D=3D +Trace backends +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 The "tracetool" script automates tedious trace event code generation and a= lso keeps the trace event declarations independent of the trace backend. The = trace @@ -182,7 +193,7 @@ events are not tightly coupled to a specific trace back= end, such as LTTng or SystemTap. Support for trace backends can be added by extending the "trac= etool" script. =20 -The trace backends are chosen at configure time: +The trace backends are chosen at configure time:: =20 ./configure --enable-trace-backends=3Dsimple =20 @@ -194,7 +205,8 @@ If no backends are explicitly selected, configure will = default to the =20 The following subsections describe the supported trace backends. =20 -=3D=3D=3D Nop =3D=3D=3D +Nop +--- =20 The "nop" backend generates empty trace event functions so that the compil= er can optimize out trace events completely. This imposes no performance @@ -203,7 +215,8 @@ penalty. Note that regardless of the selected trace backend, events with the "disab= le" property will be generated with the "nop" backend. =20 -=3D=3D=3D Log =3D=3D=3D +Log +--- =20 The "log" backend sends trace events directly to standard error. This effectively turns trace events into debug printfs. @@ -211,23 +224,26 @@ effectively turns trace events into debug printfs. This is the simplest backend and can be used together with existing code t= hat uses DPRINTF(). =20 -=3D=3D=3D Simpletrace =3D=3D=3D +Simpletrace +----------- =20 The "simple" backend supports common use cases and comes as part of the QE= MU source tree. It may not be as powerful as platform-specific or third-party trace backends but it is portable. This is the recommended trace backend unless you have specific needs for more advanced backends. =20 -=3D=3D=3D=3D Monitor commands =3D=3D=3D=3D +Monitor commands +~~~~~~~~~~~~~~~~ =20 -* trace-file on|off|flush|set +* ``trace-file on|off|flush|set `` Enable/disable/flush the trace file or set the trace file name. =20 -=3D=3D=3D=3D Analyzing trace files =3D=3D=3D=3D +Analyzing trace files +~~~~~~~~~~~~~~~~~~~~~ =20 The "simple" backend produces binary trace files that can be formatted wit= h the simpletrace.py script. The script takes the "trace-events-all" file and t= he -binary trace: +binary trace:: =20 ./scripts/simpletrace.py trace-events-all trace-12345 =20 @@ -235,23 +251,25 @@ You must ensure that the same "trace-events-all" file= was used to build QEMU, otherwise trace event declarations may have changed and output will not be consistent. =20 -=3D=3D=3D Ftrace =3D=3D=3D +Ftrace +------ =20 The "ftrace" backend writes trace data to ftrace marker. This effectively sends trace events to ftrace ring buffer, and you can compare qemu trace data and kernel(especially kvm.ko when using KVM) trace data. =20 -if you use KVM, enable kvm events in ftrace: +if you use KVM, enable kvm events in ftrace:: =20 # echo 1 > /sys/kernel/debug/tracing/events/kvm/enable =20 -After running qemu by root user, you can get the trace: +After running qemu by root user, you can get the trace:: =20 # cat /sys/kernel/debug/tracing/trace =20 Restriction: "ftrace" backend is restricted to Linux only. =20 -=3D=3D=3D Syslog =3D=3D=3D +Syslog +------ =20 The "syslog" backend sends trace events using the POSIX syslog API. The log is opened specifying the LOG_DAEMON facility and LOG_PID option (so events @@ -263,7 +281,8 @@ NOTE: syslog may squash duplicate consecutive trace eve= nts and apply rate =20 Restriction: "syslog" backend is restricted to POSIX compliant OS. =20 -=3D=3D=3D LTTng Userspace Tracer =3D=3D=3D +LTTng Userspace Tracer +---------------------- =20 The "ust" backend uses the LTTng Userspace Tracer library. There are no monitor commands built into QEMU, instead UST utilities should be used to = list, @@ -275,43 +294,44 @@ lttng-sessiond daemon for the current user prior to r= unning any instance of QEMU. =20 While running an instrumented QEMU, LTTng should be able to list all avail= able -events: +events:: =20 lttng list -u =20 -Create tracing session: +Create tracing session:: =20 lttng create mysession =20 -Enable events: +Enable events:: =20 lttng enable-event qemu:g_malloc -u =20 Where the events can either be a comma-separated list of events, or "-a" to -enable all tracepoint events. Start and stop tracing as needed: +enable all tracepoint events. Start and stop tracing as needed:: =20 lttng start lttng stop =20 -View the trace: +View the trace:: =20 lttng view =20 -Destroy tracing session: +Destroy tracing session:: =20 lttng destroy =20 -Babeltrace can be used at any later time to view the trace: +Babeltrace can be used at any later time to view the trace:: =20 babeltrace $HOME/lttng-traces/mysession--