From nobody Fri Nov 7 12:57:28 2025 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.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538754891840772.7678325337952; Fri, 5 Oct 2018 08:54:51 -0700 (PDT) Received: from localhost ([::1]:35720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8SRA-00041t-I2 for importer@patchew.org; Fri, 05 Oct 2018 11:54:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8SMB-0006am-4Z for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:49:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8SM9-0006Dy-AY for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:49:34 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:52744) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g8SM8-00062l-Rn for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:49:33 -0400 Received: by mail-wm1-x335.google.com with SMTP id 189-v6so2313796wmw.2 for ; Fri, 05 Oct 2018 08:49:18 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g3-v6sm8152343wrw.81.2018.10.05.08.49.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Oct 2018 08:49:15 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 1E0AE3E060C; Fri, 5 Oct 2018 16:49:11 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=znBkLF/pP22QwDF/F5LZVNqJW7q436G96f2f5pLIsVw=; b=gEwoakq/FoTCkskmLvvmmpZBocxLZEh1tpDCuNw16EB/fforN7jnetn6Z1MGv5zHtQ s4jq7NZrSfvLUf0yhZYPq/WUsBE5bYVEZQywIi6IQlgIYmHmnTl9DLEkhgSSvku0PMU8 4+1YLAPjCfczOOAfRRPkc+51FeOp3lU5NwbwU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=znBkLF/pP22QwDF/F5LZVNqJW7q436G96f2f5pLIsVw=; b=ABt2PQoR4+jia7RtRbs9+J6zk7u7Ow1t0WLdgdqFHkF2lsZRO10ReipsDNoj8qAZXg 3TcFUCymDKGa0l4eGKbYdNxuMHkgU/TZ1mXeaO2M0tDF+U23nzeXc3+zHv1Ms9KzK6gj 0PBqFBUxY1OH3FsXOyBoe3zQgqYs8W9GacCBZ+DMC6Fp9dy4RFY2gH3fFwJhhlK3I/gq Zd/4kLNJ3p6GMLTJ+wbNNe9dBXuKx6Zq0094wl6GNzGux4YEr+Wbp16ESpZbWPW2r7rG c1SGV/2NpGzmYZUIoDlvGcZ8FF2q9VEOkIwap+8UD4o9iMCv3cDqglWQ5sjKWUdaF7zU LWEQ== X-Gm-Message-State: ABuFfojilid/glhT5LVHXqIn6oChuku8SIJ7Sn8RQZBcrJbxtb01aNm6 9dtyCAnZiehBxkD5BkWiffhg4g== X-Google-Smtp-Source: ACcGV63yzfUWiHD5ZFaemvZdjroypzWmOBIb+a+qmhgb4gPozL+tOVLjkqa284ym19sPGDK/USd8dA== X-Received: by 2002:a1c:2081:: with SMTP id g123-v6mr8228942wmg.144.1538754557842; Fri, 05 Oct 2018 08:49:17 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 5 Oct 2018 16:48:54 +0100 Message-Id: <20181005154910.3099-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005154910.3099-1-alex.bennee@linaro.org> References: <20181005154910.3099-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 Subject: [Qemu-devel] [RFC PATCH 05/21] trace: keep a count of trace-point hits 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: Stefan Hajnoczi , cota@braap.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , vilanova@ac.upc.edu, Pavel.Dovgaluk@ispras.ru Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 When working via the HMP to dynamically enable trace points it would be useful to know if trace points are currently being hit. As the cost is low we can simply increment a counter as we consider if we are going to trace the event. This cannot be precise as we don't take care to use atomic accesses but it is usefully indicative. Signed-off-by: Alex Benn=C3=A9e --- scripts/tracetool/backend/simple.py | 2 ++ trace/event-internal.h | 1 + 2 files changed, 3 insertions(+) diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backen= d/simple.py index c2fd1c24c4..eaa19a1032 100644 --- a/scripts/tracetool/backend/simple.py +++ b/scripts/tracetool/backend/simple.py @@ -81,6 +81,8 @@ def generate_c(event, group): cond =3D "trace_event_get_state(%s)" % event_id =20 out('', + ' %(event_obj)s.count++;', + '', ' if (!%(cond)s) {', ' return;', ' }', diff --git a/trace/event-internal.h b/trace/event-internal.h index f63500b37e..8ab3a29941 100644 --- a/trace/event-internal.h +++ b/trace/event-internal.h @@ -37,6 +37,7 @@ typedef struct TraceEvent { const char * name; const bool sstate; uint16_t *dstate; + uint64_t count; } TraceEvent; =20 void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state); --=20 2.17.1