Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp545839pxb; Mon, 25 Oct 2021 13:27:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYE1k4pJvefo+x8YhEIZLSzyrAynUjUFIzrGcHh3V5ShQAiJa+xLUdkLA7Lx8VUmioZ+Jl X-Received: by 2002:a05:6402:270b:: with SMTP id y11mr30025297edd.387.1635193650274; Mon, 25 Oct 2021 13:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635193650; cv=none; d=google.com; s=arc-20160816; b=DuquFvA6WYFJqDp5MBcAb5MAmWfSTd+RgGexABdDag5JvdRND4Uzy0cUp+0YayQ9vt VjcWYJpY9UGtogBihO8tbRZgD84IyWcjgJ07aFDpwFw9wfp+gB5Pi1lN+VpCW7Y0iMlt 9MvqKIY3jwtuEUAsab7pDCp1NtO8yxKDyTHKTyTSrVdPvQfqh+qSp3wrINZFtI7Kpg8U JlCcEILDE05x715BOtM5ANfA41IRx247qK9ct0jkhhEhl0cSdYeVs4dZfcHGklXrXFKJ 9RdFrf84wsYOetGuN6cK6S7ATVcMzXdcnEkuqYjvQaYfcJHF6oGhoplCeBTspslWmNvY /6YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=kE3Nv1lKwT793xJwq+iC3RoCHqpYdQS3Tip3semgyOw=; b=k1pSblaM4e0/K/jh2zyhaA9n4UNTqHTb+wnnTMvLq8bXYDJl58Aa+vbz8lULb3YPbR gNdzbNPP9I9A2AptUA+EARnb3LislHoiAixjrqvKcrFOYf6Nno6i54QcTcyTiXeMLChG h/uUJdcqLg+BcGPDcO+EdK1vwinALWzlYtZQIuOrGTxztZMoaNX65dHQGgKCLAcXFVh2 N6a1DsYHeab9kIK7aNIc3T5Dq0NzLyq57D/NSd9NRlgbccR/G8H/7H94fpn0kTodBJzK kmUIyBkeCdsoEj2GpRVXxnoWbflb8qEDiO+drZW77vV0RZcFaLXGQ6M7ywQHZOULJ7AM 5zFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="jT9hL/u1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20si29026261edc.499.2021.10.25.13.27.05; Mon, 25 Oct 2021 13:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="jT9hL/u1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235381AbhJYU0t (ORCPT + 99 others); Mon, 25 Oct 2021 16:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238131AbhJYU02 (ORCPT ); Mon, 25 Oct 2021 16:26:28 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464BDC04F584 for ; Mon, 25 Oct 2021 13:11:47 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id mv23-20020a17090b199700b001a20f0fb7d0so204332pjb.7 for ; Mon, 25 Oct 2021 13:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:cc; bh=kE3Nv1lKwT793xJwq+iC3RoCHqpYdQS3Tip3semgyOw=; b=jT9hL/u1NDVN8zR7XKWAcsKCnfrWgrjG5UI5cJQnv1KhEb9MBx3ekh/Z7RCbqnTgLW R5aN9TfzGZzqZc0QenFl6+Ar37BPVJ2L1WvdSeaA4WXT3GuM4umVUCgkIC3FWLrshtre 955z0qFElgDGpho9GqY+box4Yjy619K0mUiylpcdbifZ8WO5LL0hKiM/rhkeeFPbI3/J sAby+jo00xUuZx1RXFD4rh9BdO4G5j18EPfStl0l+oMpjCxz81MbMhS/GLMcppZtta26 54fKEJrvYVyg7GR/d3k5wjJVgaJ45UekfB2u8WRjT6oCWuM+6VVUDDkf9Irst4eA/y7D L8/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=kE3Nv1lKwT793xJwq+iC3RoCHqpYdQS3Tip3semgyOw=; b=dWeqR4a3f3tgj8KEczXvecYzQYcATMbfs7gLddtJ8t3adjHYQdIYoVNUybcfjrUo3q RMVZG0bVblBoV3nrb4/GmLlz5ETk7+jRPOf/v/vO+s2LHvBDQs1g/PdAbM7RroQEXN37 Oee6iF859vJBgMqPxaYzgPf4pv302O5IfYN1+KQvGMQwfJo+K54yOinSnDtYQRlvmgZy XOTpyn6lvPitBvPIPPqTWJymMU8REoHtNMJdF0jYC2/He/AJfpl8oAdN3f0KvJ8adUNk 0acoGSTeKHLcJnNGG7NU3ZJPNpT5gf0ArqHtPklM9zsu6Ojo3pINmeqCf2aAN25QSbx/ /Pzw== X-Gm-Message-State: AOAM530tCdxPp8bl6UhqrkGyGk8uQLX5XYbW5WaO9TXlohTkpsSJBjwH Wxy/sZyBwqvSinrkunj1oaHePS3QUPQxrWuYPw== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:b783:5702:523e:d435]) (user=kaleshsingh job=sendgmr) by 2002:a17:902:a3c1:b0:140:5de3:9c95 with SMTP id q1-20020a170902a3c100b001405de39c95mr5367547plb.75.1635192706759; Mon, 25 Oct 2021 13:11:46 -0700 (PDT) Date: Mon, 25 Oct 2021 13:08:40 -0700 In-Reply-To: <20211025200852.3002369-1-kaleshsingh@google.com> Message-Id: <20211025200852.3002369-9-kaleshsingh@google.com> Mime-Version: 1.0 References: <20211025200852.3002369-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH v4 8/8] tracing/histogram: Document expression arithmetic and constants From: Kalesh Singh Cc: surenb@google.com, hridya@google.com, namhyung@kernel.org, kernel-team@android.com, Kalesh Singh , Jonathan Corbet , Steven Rostedt , Ingo Molnar , Shuah Khan , Masami Hiramatsu , Tom Zanussi , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Histogram expressions now support division, and multiplication in addition to the already supported subtraction and addition operators. Numeric constants can also be used in a hist trigger expressions or assigned to a variable and used by refernce in an expression. Signed-off-by: Kalesh Singh Reviewed-by: Namhyung Kim --- Changes in v2: - Add Namhyung's Reviewed-by Documentation/trace/histogram.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst index 533415644c54..e12699abaee8 100644 --- a/Documentation/trace/histogram.rst +++ b/Documentation/trace/histogram.rst @@ -1763,6 +1763,20 @@ using the same key and variable from yet another event:: # echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ...' >> event3/trigger +Expressions support the use of addition, subtraction, multiplication and +division operators (+-*/). + +Note that division by zero always returns -1. + +Numeric constants can also be used directly in an expression:: + + # echo 'hist:keys=next_pid:timestamp_secs=common_timestamp/1000000 ...' >> event/trigger + +or assigned to a variable and referenced in a subsequent expression:: + + # echo 'hist:keys=next_pid:us_per_sec=1000000 ...' >> event/trigger + # echo 'hist:keys=next_pid:timestamp_secs=common_timestamp/$us_per_sec ...' >> event/trigger + 2.2.2 Synthetic Events ---------------------- -- 2.33.0.1079.g6e70778dc9-goog