Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1016115pxb; Tue, 19 Oct 2021 18:37:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+gReQRbaIoMzxO24ItU1RRQxx4ZUC1F3pY6zyyPKv8CFBxe4IX7sTKsIMrbD+GmhHHkn4 X-Received: by 2002:a63:9809:: with SMTP id q9mr14417809pgd.235.1634693844609; Tue, 19 Oct 2021 18:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634693844; cv=none; d=google.com; s=arc-20160816; b=dlnTNsJKgZATAmlRgLsM+JCFfluXzQUMTftBU6byQh1kPs6c0gwDkh4xs8dtJcROiY 1Yo+EQKOrqrcs47YSEFdBHfzxzM22B/pgzs15nnO24f0QpdYDR8VvHZb8iVERClggJux fcwF6lPYrzDoVd71rEaOK9n5RaxMNqJxU59ejPiroip7BHwY6ozg4Nq9LS5pxrh2qyzW 7/3i4kzqvh95twfDW5RbhuAmor9wyjqiOmHWeHkGvOByeR3pop6X3XFwI9YMNCp+HiMi 6phBzqGSOOrCPnW0kV0DlkjwE/FCm4lla/v4xTJiNHHhXsmUjscJgmWGUefYxybYOYa9 z7Tw== 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=IYOJmQ2nEaASN59pmylXXLLP+FrglnzeH7l3JWIvSSI=; b=pfcE95+sFH15/G2TIJDG7ui5GoXfvIZliV9N0VjX88gaVn7ipxsZ+tC6BYt6FN8fY6 C1XsGZWUSPqfmrbtzVxEZ0F6U/dUQwaDVorJPDUypy/LN/4gADJUncUsEAf7N7GjESAI Oi0K7Vvr9Eq+y90q6FGhaXCjvIEiF5X+9N1ppMNIsbQwumPlGq6wwCp1EpShkLMGbe60 vVTDA8yA2tLzjRO0fE2CEjgORI7ra+C4gIEXud9rePLBplIn4KA/7W+hkqD8osVY5xzj QQ2umIYpvZkwzCrCHW1gUxj28w0Sy5UaNTypRy4Jt3JX4pX7uquVgI2Z9Mjum8juQgNo Hjdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XGXOwhu+; 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 a65si870076pge.362.2021.10.19.18.37.10; Tue, 19 Oct 2021 18:37:24 -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=XGXOwhu+; 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 S229910AbhJTBhU (ORCPT + 99 others); Tue, 19 Oct 2021 21:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbhJTBhT (ORCPT ); Tue, 19 Oct 2021 21:37:19 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11CC7C06174E for ; Tue, 19 Oct 2021 18:35:06 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id c65-20020a251c44000000b005ba81fe4944so27908172ybc.14 for ; Tue, 19 Oct 2021 18:35:06 -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=IYOJmQ2nEaASN59pmylXXLLP+FrglnzeH7l3JWIvSSI=; b=XGXOwhu+3ly4GGQ1oRi8qz2yqWWUke3CkXEYsjduM7C/tJS6yJeHXy2j5xGYawLq2z rb1FEnzkNVoLle2OjDHjZTO+RnowokFV8JDHe5avoDhfLbEKSnFnO2Vtk6N3UDhuSxty v+KTsqzaz9kw8ZRK+XP10KKGJhyeWhJ2IF9/ZzDlXeo28BAZ57R/6WkRD0tRd7hZRUqs nqR77wQaksmIDKYEDKZcJ7Fv9+8ByKyq5+OWyZfZh+CDUSSc/qhD/H0VKYKloOMGPEB3 lcj/VdaCp+ojGLKD7HKQPGhf/g0uwhUvK74T39GjDQecSd1WGaxrgrPT/QGdZDJEHvsV 8WoQ== 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=IYOJmQ2nEaASN59pmylXXLLP+FrglnzeH7l3JWIvSSI=; b=lQgy8x45kPX97Luiwzp0MeLq/arj9D3dK33AvrNfV+McBwGc0/fbcdAzczjlvMq6z/ PE2a2SyoA6I1GDED0TIxGnemK6rC48ODYAcffkV7jelfPMC2DLtHGQ25HeAjv87S2gr/ JF9QsrSqCIYPosTKSG6PyrbGqFZOe2q5NuJqo5OgzShCXU1pvZTtko3Da/Ak5gUs6L/e Yle4hb837KDNXBETMSPclwaiTLDWFgmvol7glfsDB8KJ2Unsi2ux3TtE6RYL/1P+99xW rpt6uEUjyhf1bL6TfG8ygkL2KKPO+2mUx/jYGGdlPeruPNACPBGn+V1v8/jQp44s1fw4 HCkw== X-Gm-Message-State: AOAM532nj2lNdBo9OvUVPmNRpWED33nCHOrKOp5tTHcABJ3jKCu7p+GL LhN7WYRxPiJ1Ul7K68FpK3aSlvsm/d7wzVT4cw== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:1953:b886:7a6c:bf0]) (user=kaleshsingh job=sendgmr) by 2002:a25:1b0a:: with SMTP id b10mr40405957ybb.520.1634693705344; Tue, 19 Oct 2021 18:35:05 -0700 (PDT) Date: Tue, 19 Oct 2021 18:31:42 -0700 In-Reply-To: <20211020013153.4106001-1-kaleshsingh@google.com> Message-Id: <20211020013153.4106001-6-kaleshsingh@google.com> Mime-Version: 1.0 References: <20211020013153.4106001-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH v2 5/5] 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