From nobody Mon May 6 21:51:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491904687012501.92608666202557; Tue, 11 Apr 2017 02:58:07 -0700 (PDT) Received: from localhost ([::1]:38233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxsYm-0004xr-Tk for importer@patchew.org; Tue, 11 Apr 2017 05:58:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxsXw-0004fn-KQ for qemu-devel@nongnu.org; Tue, 11 Apr 2017 05:57:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxsXt-0005xR-BC for qemu-devel@nongnu.org; Tue, 11 Apr 2017 05:57:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cxsXt-0005wh-52 for qemu-devel@nongnu.org; Tue, 11 Apr 2017 05:57:09 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 6C099C04B93A; Tue, 11 Apr 2017 09:57:07 +0000 (UTC) Received: from localhost (ovpn-116-128.ams2.redhat.com [10.36.116.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08CF0B58DB; Tue, 11 Apr 2017 09:57:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6C099C04B93A Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6C099C04B93A From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Tue, 11 Apr 2017 10:56:54 +0100 Message-Id: <20170411095654.18383-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 11 Apr 2017 09:57:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] simpletrace: document Analyzer method signatures X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Users can inherit from the simpletrace.Analyzer class and receive callbacks when events of interest occur in a trace file. The method signature is a little magic because the timestamp and pid arguments are optional. Document this. Signed-off-by: Stefan Hajnoczi Reviewed-by: Alex Benn=C3=A9e --- scripts/simpletrace.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index 4c99004..d60b3a0 100755 --- a/scripts/simpletrace.py +++ b/scripts/simpletrace.py @@ -116,7 +116,28 @@ class Analyzer(object): is invoked. =20 If a method matching a trace event name exists, it is invoked to proce= ss - that trace record. Otherwise the catchall() method is invoked.""" + that trace record. Otherwise the catchall() method is invoked. + + Example: + The following method handles the runstate_set(int new_state) trace eve= nt:: + + def runstate_set(self, new_state): + ... + + The method can also take a timestamp argument before the trace event + arguments:: + + def runstate_set(self, timestamp, new_state): + ... + + Timestamps have the uint64_t type and are in nanoseconds. + + The pid can be included in addition to the timestamp and is useful when + dealing with traces from multiple processes:: + + def runstate_set(self, timestamp, pid, new_state): + ... + """ =20 def begin(self): """Called at the start of the trace.""" --=20 2.9.3