Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1088537rwe; Thu, 25 Aug 2022 15:23:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MyFF5D7c1EI/AvjMA27s+FO2CiEBmnb9Mxueforu6Fm23oggW9bkWxck86Y0Np2xhXCSG X-Received: by 2002:a05:6402:156:b0:440:b458:93df with SMTP id s22-20020a056402015600b00440b45893dfmr4870731edu.337.1661466228443; Thu, 25 Aug 2022 15:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661466228; cv=none; d=google.com; s=arc-20160816; b=0NumglQpgPd2E+34bfnBAaGguFkEmnXPi6O42mH4CV462fqOK1SGubwZqyN0p5XY98 0Md7sQ++om/aezl9x3nr8IZrgGLlJdm9GrHSPAHeF6Ip3r0qDU9Z2lJ3nK0wTpYj8Nde JjdLAHpRduRxo1qNE1RnqfFM3I+2Vmu5TJoFTUNblQ8b1rMpOhmzQf8w/BUyHiUipGZ0 rbxiqYSnwaOqQUxzA5KziWPRKQ+ptt/Cs0KqWvXWXwUX26Ex616cVoNEkymuVmhxrsxY mvQOvK3NKHKPB5eWJdBFz8Afqw2oHZ0grs6FVQCb2Fr2XPOyiM0njtFsdkCKgZtFMhI6 +x9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z90CXzwgZhrEucXsLwVmTJl+nej1e2W0sKr92Kj1SoI=; b=063hDUmGTAcMuuFyV5L4gh1wxHuj+8F1f2oQ21Qgt8b5e/7kcxJGogBovTCXvAjpD9 emnerFhV+jF1UHNlPGUccyW7NMP9Qos6Iq1uWhpFc7OXRqix6Xe57MIJbO4nQRPxcZTU 1TWb941s55GFRKLrRWIByvfCE79xzqVEUPsnI0OIMqbaYj/ePQPWDgK2Tjptxp0RnL9s I9Nz7ueQ1cAPB+bygeNpKHKr6W1ElSV+1k70kOUDgR37AUC/2w+7ciF1PXIKbID7Xh2g QEC9+ZfPpXDbxtJK7FKI5jS9lltS9+66496MiSZG/I9HnrZiOilEqvm1NiH19C3PZUeX xeWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VBKVn2XM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a1709060cb100b00730a07ef039si192735ejh.423.2022.08.25.15.23.23; Thu, 25 Aug 2022 15:23:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VBKVn2XM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243973AbiHYWTQ (ORCPT + 99 others); Thu, 25 Aug 2022 18:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243933AbiHYWTM (ORCPT ); Thu, 25 Aug 2022 18:19:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21932C0E60 for ; Thu, 25 Aug 2022 15:19:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B9F60B82B29 for ; Thu, 25 Aug 2022 22:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AA4CC433D6; Thu, 25 Aug 2022 22:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661465948; bh=ea9EgdnqEW7WsDo1Ihdc0Otqc3WndDziUCFn40MAu90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VBKVn2XMtf/CzHWHfZVYssxrd30EQLlJRypsYKBgDsBC4uoDXgEQRRwQqUJtcP74j ZPLZ2AoO6xjvfoMIp2h/NZ3316PoT8X0gzOogXr0KnA91dADNGVnTy+zRraT10M6w1 HSKfDHeXfuvRODVLSF2CIHv18HQI03SlvGdf+kf2dDhOeGlz4iT3k+zLDNVeOtbzJp BSvNFyqGzDwIHoA3w1CMtQDpeKCTEl0AlGtVkIF/+z6ppx1vzKgIHclBV78s7AP30V VWtFZi9QZBChHImcGFbjfOoswnLHti3GCjfhBd2XJ14eetHd3pcasTmOLSHDghKXvX 0nYVG7m/v07MA== From: Tom Zanussi To: rostedt@goodmis.org Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] tracing: Allow multiple hitcount values in histograms Date: Thu, 25 Aug 2022 17:19:01 -0500 Message-Id: <2b0a73549f8fb4115c06639c75a4b7abd7825aaa.1661464992.git.zanussi@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The hitcount is treated specially in the histograms - since it's always expected to be there regardless of whether the user specified anything or not, it's always added as the first histogram value. Currently the code doesn't allow it to be added more than once as a value, which is inconsistent with all the other possible values. It would seem to be a pointless thing to want to do, but other features being added such as percent and graph modifiers don't work properly with the current hitcount restrictions. Fix this by allowing multiple hitcounts to be added. Signed -off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 92fbd72b6408..8f858e0bdaf3 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -1356,6 +1356,8 @@ static const char *hist_field_name(struct hist_field *field, field_name = field->name; } else if (field->flags & HIST_FIELD_FL_TIMESTAMP) field_name = "common_timestamp"; + else if (field->flags & HIST_FIELD_FL_HITCOUNT) + field_name = "hitcount"; if (field_name == NULL) field_name = ""; @@ -2328,6 +2330,8 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, hist_data->attrs->ts_in_usecs = true; } else if (strcmp(field_name, "common_cpu") == 0) *flags |= HIST_FIELD_FL_CPU; + else if (strcmp(field_name, "hitcount") == 0) + *flags |= HIST_FIELD_FL_HITCOUNT; else { field = trace_find_event_field(file->event_call, field_name); if (!field || !field->size) { @@ -4328,8 +4332,8 @@ static int create_var_field(struct hist_trigger_data *hist_data, static int create_val_fields(struct hist_trigger_data *hist_data, struct trace_event_file *file) { + unsigned int i, j = 1, n_hitcount; char *fields_str, *field_str; - unsigned int i, j = 1; int ret; ret = create_hitcount_val(hist_data); @@ -4346,8 +4350,10 @@ static int create_val_fields(struct hist_trigger_data *hist_data, if (!field_str) break; - if (strcmp(field_str, "hitcount") == 0) - continue; + if (strcmp(field_str, "hitcount") == 0) { + if (!n_hitcount++) + continue; + } ret = create_val_field(hist_data, j++, file, field_str); if (ret) -- 2.34.1