From nobody Tue May 21 23:21:37 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=1612194757; cv=none; d=zohomail.com; s=zohoarc; b=cHjg/EW0ABywuc1i867yskBgVITif6rRNZMNB1ci714EWV2NTcALVoKHiCKNu4dwQdken3Q0ETohZigxPCcsARRbdV8Rt82pYjz8HWGBd98NQVvskHuzpU0ulwYKhEPpj96Nvb1+jYJ0UzewZKJSs+1tfJ9mQauEX8cGTLP0kNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612194757; 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=Aw2aaqFmUOPIaJnnia04oigbk8nUxqBEWnZVexh5mW8=; b=a/a/eJ+VQ6J4IBmHjdwltp4lACcl0XUT3lK8Pm/3v97EB1h2hjd4SVb/KKEs+ZRU6qC3bPz75ta5UtqmST11lHPRjBI9Gaed+1Vt4gF5J2h8s3CsKHdtpORxMLoGV3FHdizAntaQZv/mnbtEEFPcFqwlWaMV9IdIbwmUTtBHDV0= 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 1612194757155583.8607425176999; Mon, 1 Feb 2021 07:52:37 -0800 (PST) Received: from localhost ([::1]:52076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6bVD-00043q-My for importer@patchew.org; Mon, 01 Feb 2021 10:52:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6bS5-0000FV-65 for qemu-devel@nongnu.org; Mon, 01 Feb 2021 10:49:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6bS2-0007dk-Sc for qemu-devel@nongnu.org; Mon, 01 Feb 2021 10:49:20 -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-277-Cv5wwW0NOOO_wY0dEe95BQ-1; Mon, 01 Feb 2021 10:49:13 -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 A2EEF10D40A3; Mon, 1 Feb 2021 15:47:51 +0000 (UTC) Received: from localhost (ovpn-115-140.ams2.redhat.com [10.36.115.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7B055C1A3; Mon, 1 Feb 2021 15:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612194558; 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=Aw2aaqFmUOPIaJnnia04oigbk8nUxqBEWnZVexh5mW8=; b=OjlEF7WAvFGd/r4WJpua/Wa+5J4b9mkVak9idJtCySMuI74Eur+4fJP78H/zyS8LV27xTO yG7K5Sx1CtkELyCm8KeKpGXOWdUvKFzVXMpkNqHpNiEIXRq9DCFX9ldveLUOYgm8b0iFh7 dj0yRaKwnxt3Fq6dqloqikm/DQtJvGE= X-MC-Unique: Cv5wwW0NOOO_wY0dEe95BQ-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 01/11] trace: fix simpletrace doc mismerge Date: Mon, 1 Feb 2021 15:46:53 +0000 Message-Id: <20210201154703.180022-2-stefanha@redhat.com> In-Reply-To: <20210201154703.180022-1-stefanha@redhat.com> References: <20210201154703.180022-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: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.351, 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 , Eduardo Habkost , qemu-block@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Cleber Rosa , Paolo Bonzini 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 Message-id: 20201216160923.722894-2-stefanha@redhat.com 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 dba43fc7a4..313b8ea4e9 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 Tue May 21 23:21:37 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=1612195057; cv=none; d=zohomail.com; s=zohoarc; b=WRJXxiTitJrG1nWMde6YiaVNFe7cd22leK0XM/Gdi7Q3qqG/C9RtOM2rQqeP29a3Emj157fdMHkQz4fp8AcqqPRcKIX1RHmH0ojy4QZxlwjhQbCGkzOiW3olZBy/CwXUMlpw0stDWNKq4nVVzpY21ihZvasfqyAoP6B2r6IbU+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612195057; 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=q6OgaUSnngZHbYWWm4QIoi/uhcxQ8/I++PU8y9xYgbQ=; b=IhlwUKxcyyKiaMo8YIgxvoHtkPnwwKf5ME0uidy/sw4QvYJtLhcjrTImiuaE0gjJEfFSjD1fJS/pNOgO1Nfaqv92lZ5cSNUUbO7c6BGgFIfZ2+Vmi8AYXSq07Z9JdNVyLYPKvS6Ye4r2cuB7ju/DuzwDsOkOucwi6NmKeGlnr8Q= 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 1612195057205872.6555810849954; Mon, 1 Feb 2021 07:57:37 -0800 (PST) Received: from localhost ([::1]:37866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6ba4-0001sU-1t for importer@patchew.org; Mon, 01 Feb 2021 10:57:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6bSu-0001Xs-Kz for qemu-devel@nongnu.org; Mon, 01 Feb 2021 10:50:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6bSn-0007zo-Qv for qemu-devel@nongnu.org; Mon, 01 Feb 2021 10:50:12 -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-589-bROkb8sgOES5l1k48_rOCg-1; Mon, 01 Feb 2021 10:49:59 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 859981140752; Mon, 1 Feb 2021 15:47:53 +0000 (UTC) Received: from localhost (ovpn-115-140.ams2.redhat.com [10.36.115.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCF8D100164C; Mon, 1 Feb 2021 15:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612194604; 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=q6OgaUSnngZHbYWWm4QIoi/uhcxQ8/I++PU8y9xYgbQ=; b=Vrzhq8cZbY3O9bNPrmDnf2Utwk+G/UaZoBJMu3jOiHdiKBVld2L1W4rki7xFVnGpAHPxvv j8Obh0Eyj2IdDXFfHsieOr57HaQ3RfehgTSECPS/dKNPz8geDmRKo3qYfUUeIc5Y10R38Q gNqg6WQrkA59Vk86OW/v2tCVZ1ti39M= X-MC-Unique: bROkb8sgOES5l1k48_rOCg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 02/11] tracing: convert documentation to rST Date: Mon, 1 Feb 2021 15:46:54 +0000 Message-Id: <20210201154703.180022-3-stefanha@redhat.com> In-Reply-To: <20210201154703.180022-1-stefanha@redhat.com> References: <20210201154703.180022-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.351, 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 , Eduardo Habkost , qemu-block@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Cleber Rosa , Paolo Bonzini 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 Message-id: 20201216160923.722894-3-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- 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 ea0e1e17ae..98a7016a9b 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -28,6 +28,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 313b8ea4e9..f7e589f67c 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--