From patchwork Fri Oct 5 15:48:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 148201 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp617747lji; Fri, 5 Oct 2018 08:55:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV61UPj7c3YI4eMZVYpBvY0j/BVqn5H95cj3Yw/qb4q88EgHd5ohFeo6FVraHFbtGk1vgQQfs X-Received: by 2002:a0c:d48d:: with SMTP id u13-v6mr9796574qvh.165.1538754934233; Fri, 05 Oct 2018 08:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538754934; cv=none; d=google.com; s=arc-20160816; b=CW+AARdUpzEMOtuDJ75B6eWzYYDU121603BaRcNBwZPpqzrrjj4fPGJAyQlGs0cRW+ cPBeSyV26+7ixp+3OTDgJU3eqziXOiL/Bu6ynbJVmO0vb2IAvucVos3/6CeJWT2bq+uu 2Zl1THayw2dD0S0EXjbUtnRfPqt6W7KcV4/05d43ANY35pajSZqkdYAxPJn8g/13+uJX JkXqDeeRN3nddtBAg2bOFOwgONvL286brQbMV/sUbXefs3Pb4Ndl+fU+7hg2ZqXQ/QAa JWv+Bv1jlmDb/sPg3+5d7kWXazEIes0Xmvmjb8izBWbcfiaVGEE7VTHb7Zcqul8QdOdg /xwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=znBkLF/pP22QwDF/F5LZVNqJW7q436G96f2f5pLIsVw=; b=Pi3ekZinSQ3mG38BgDi0ZOok6FLbC9Cb8wWDFvGOMO8Ta96gtOJjM/BTH9FvS4Cj8n 7951sazYJMj+pw6lDzxG6qxgSVneZDPlGvw5pD8HeWVpwbXJPXjx6B8Es4AK4NHxzX36 WckTHWxHSEMSWPWU6PZVmBWbT6dpmlh2NhTtXWKUdR6rY3IczYOgGW2rO7gmKyu8Hpfx NP43dSqsPrBnJMHZsiXOKTuWmnXriCsodzEOaz9A8WM8m+PO4B+SYyHLmO7VgZW0gnf2 WfbxAYM+Y56q8PZI3+PV+kKj4MUhJajw3vYDV5UE4xLg64aWYswXmOJMhKc7zcpczX/L 010g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="gEwoakq/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r1-v6si5775857qtm.169.2018.10.05.08.55.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 05 Oct 2018 08:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="gEwoakq/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8SRx-0005do-HW for patch@linaro.org; Fri, 05 Oct 2018 11:55:33 -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) 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-Received: by 2002:a1c:2081:: with SMTP id g123-v6mr8228942wmg.144.1538754557842; Fri, 05 Oct 2018 08:49:17 -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) From: =?utf-8?q?Alex_Benn=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 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_?= =?utf-8?q?Benn=C3=A9e?= , vilanova@ac.upc.edu, Pavel.Dovgaluk@ispras.ru Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- scripts/tracetool/backend/simple.py | 2 ++ trace/event-internal.h | 1 + 2 files changed, 3 insertions(+) -- 2.17.1 diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/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 = "trace_event_get_state(%s)" % event_id 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; void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state);