Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp847812ybt; Fri, 26 Jun 2020 13:03:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzy98/Pb56YdD2MB/SxLnc6D93CC1WKcK/vpFxsuogPqbZd5NwjNujMmDWS4e3hkXVUW6O X-Received: by 2002:a17:906:148a:: with SMTP id x10mr4304626ejc.497.1593201823555; Fri, 26 Jun 2020 13:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593201823; cv=none; d=google.com; s=arc-20160816; b=gHgOwTgb8ZrYZCfNS/OG7h1bETRN+ow6+BljSh36U3Rj6+JVta1f0p/d3y2RN6+0eR SeTrlBVnmNvA3IzoJgMD5a6LLeDfjtucyp98s1zJpTnvm6mTvEFd8DlpMW5s5b4+mJAz fUS25Pv7KJjcwMHHiJRORVaE8fajBX1/+EwmnB4CWnMk/bF/aBKS/Di5C+oBYRcz1+Bj SbHOyGJwOiklG7zQIVrNnTAwKhsvV36LMWz2nLufumjwqrrLgfdGWtl8hzm5GKgTH3MD LqFKBNLD6SP3EBD8ZgwpUrGOhGaxM4+lYCmzDScaRsp5wVTDaW2ehGM85DdtmAnILtft ME7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lbKE8B5Gu+f9N6+tuSxc/2z2J262A6WuLfgwyXskAFg=; b=fZpUYHWjTKrE01H23aOmTZtki1UXqNUGcKfUC2m6JeCHEe4hPrKcI3wrwzhUb9ILRr iz0wyRJuVY/CShWVvlC2OpE+cyPUp9oaQeC8xd84+j0XKhnRTBM0WFaLD6U+g5U1ToMA UJcFDp7e1u7oOn6QM3aygyAnBK7QV4j1aAiuGCh/d1dApmQsjGsudQKmqUoRfFfZAqJz Is9HjJpnkss9TkCqp6AweIOHfdNpx2p+0CLPrGV0H8XjfX8K1xAgYBWWMZJRUb6+hROq rZW5htCFPU+xOn3tdVd22y39AHNdmFy13BWacVZm9JF9jo0A3WWXAFSxrKv8efn7+R9D U64w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RAG4mK+V; 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 w6si6489983eju.595.2020.06.26.13.03.20; Fri, 26 Jun 2020 13:03:43 -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=20161025 header.b=RAG4mK+V; 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 S1726279AbgFZUCF (ORCPT + 99 others); Fri, 26 Jun 2020 16:02:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbgFZUCE (ORCPT ); Fri, 26 Jun 2020 16:02:04 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEC01C03E979 for ; Fri, 26 Jun 2020 13:02:04 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id f18so2537536wrs.0 for ; Fri, 26 Jun 2020 13:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lbKE8B5Gu+f9N6+tuSxc/2z2J262A6WuLfgwyXskAFg=; b=RAG4mK+VLbFsOfmcM5BVz/lAPGjg31YVjTeeHHlg9D4GqMQQarK3s47Ny3zIan/a6F 5gt4H/XK7yf+epxGBBBSNXJQdyGRD7VApQFyQfeK+AuXxp9brwX8PZF/J4lsMrYNeWIM O0yMrYkGgm3a05MH8Yqks7VzgHafqxOTt1PGmzKLcE8DoYCcMgVxjNmRxi5XnCLYspO2 WolkCZDzdIF5NyW6BmzN1Vd0+xfsLbt1V9Pg3Hu9A4Wo+qpCP/4QR9UVwvWovEuhoHSl xx4J8iNPdgAX8fWLlqK/CvgCRQBuiJSOxgVoo7sAhQAsAE4d6DK/SRK15sCJylZGvMXs HyJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lbKE8B5Gu+f9N6+tuSxc/2z2J262A6WuLfgwyXskAFg=; b=paPPmBF+AfJHiDiUkY9EXfdpLe7FZN12UtFKMF/x+f2SnKMomK21C+53/2joN0U7dc DL6KbYf8m+V3eRmFNMK4wWnt0nS0isZoqz9isu6O1vDDbSEA4GtMRtSMNLHmr7HkOjVt 9mAwZ+pGc9F7ZH951scgZOx8fMylhr0aceU94dDUyW6ERlg+bTjn6YAN/CFy2BH/4uNV MVHCI5fuXLlwvbXMhIBhodm55ywsqCudjKHp0tyiEymdriv9pJ0H3DY7E1kbwSutrnOx 5I8GuNaaU8CMpBe0qvNAf6hJx+d2vky34lNFkcC/rK11k465U6SLPcnwL9EGOohKLjKW tCdA== X-Gm-Message-State: AOAM533VCy6LUNxSIlpfnFEpbwVsQmQryWLYN+jdqmuw/4QUkdizKbPy XPBZTg6SVr16P150VjsQCQm4Rc5cyFUl2Qh3owzd4853 X-Received: by 2002:adf:df03:: with SMTP id y3mr5143514wrl.376.1593201723167; Fri, 26 Jun 2020 13:02:03 -0700 (PDT) MIME-Version: 1.0 References: <20200626194720.2915044-1-jolsa@kernel.org> <20200626194720.2915044-2-jolsa@kernel.org> In-Reply-To: <20200626194720.2915044-2-jolsa@kernel.org> From: Ian Rogers Date: Fri, 26 Jun 2020 13:01:51 -0700 Message-ID: Subject: Re: [PATCH 01/10] perf tools: Rename expr__add_id to expr__add_val To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , John Garry , "Paul A. Clarke" , Stephane Eranian Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Firstly, thanks for this work! On Fri, Jun 26, 2020 at 12:47 PM Jiri Olsa wrote: > > Renaming expr__add_id to expr__add_val so we can use > expr__add_id to actually add just id in following changes. Perhaps clear up in the commit message that add id won't add an id and a value, just the id. I don't mind long intention revealing function names, so expr__add_id_with_val may most fully convey this change. Thanks, Ian > there's no functional change. > > Signed-off-by: Jiri Olsa > --- > tools/perf/tests/expr.c | 4 ++-- > tools/perf/tests/pmu-events.c | 4 ++-- > tools/perf/util/expr.c | 2 +- > tools/perf/util/expr.h | 2 +- > tools/perf/util/expr.y | 2 +- > tools/perf/util/stat-shadow.c | 4 ++-- > 6 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c > index b7e5ef3007fc..82aa32fcab64 100644 > --- a/tools/perf/tests/expr.c > +++ b/tools/perf/tests/expr.c > @@ -24,8 +24,8 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) > struct expr_parse_ctx ctx; > > expr__ctx_init(&ctx); > - expr__add_id(&ctx, strdup("FOO"), 1); > - expr__add_id(&ctx, strdup("BAR"), 2); > + expr__add_val(&ctx, strdup("FOO"), 1); > + expr__add_val(&ctx, strdup("BAR"), 2); > > ret = test(&ctx, "1+1", 2); > ret |= test(&ctx, "FOO+BAR", 3); > diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c > index b66b021476ec..b3b835982cab 100644 > --- a/tools/perf/tests/pmu-events.c > +++ b/tools/perf/tests/pmu-events.c > @@ -492,7 +492,7 @@ static int test_parsing(void) > */ > k = 1; > hashmap__for_each_entry((&ctx.ids), cur, bkt) > - expr__add_id(&ctx, strdup(cur->key), k++); > + expr__add_val(&ctx, strdup(cur->key), k++); > > hashmap__for_each_entry((&ctx.ids), cur, bkt) { > if (check_parse_cpu(cur->key, map == cpus_map, > @@ -547,7 +547,7 @@ static int metric_parse_fake(const char *str) > */ > i = 1; > hashmap__for_each_entry((&ctx.ids), cur, bkt) > - expr__add_id(&ctx, strdup(cur->key), i++); > + expr__add_val(&ctx, strdup(cur->key), i++); > > hashmap__for_each_entry((&ctx.ids), cur, bkt) { > if (check_parse_fake(cur->key)) { > diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c > index e8f777830a23..a02937e5f3ac 100644 > --- a/tools/perf/util/expr.c > +++ b/tools/perf/util/expr.c > @@ -33,7 +33,7 @@ static bool key_equal(const void *key1, const void *key2, > } > > /* Caller must make sure id is allocated */ > -int expr__add_id(struct expr_parse_ctx *ctx, const char *name, double val) > +int expr__add_val(struct expr_parse_ctx *ctx, const char *name, double val) > { > double *val_ptr = NULL, *old_val = NULL; > char *old_key = NULL; > diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h > index 8a2c1074f90f..35bdc609cf55 100644 > --- a/tools/perf/util/expr.h > +++ b/tools/perf/util/expr.h > @@ -22,7 +22,7 @@ struct expr_scanner_ctx { > > void expr__ctx_init(struct expr_parse_ctx *ctx); > void expr__ctx_clear(struct expr_parse_ctx *ctx); > -int expr__add_id(struct expr_parse_ctx *ctx, const char *id, double val); > +int expr__add_val(struct expr_parse_ctx *ctx, const char *id, double val); > int expr__get_id(struct expr_parse_ctx *ctx, const char *id, double *val_ptr); > int expr__parse(double *final_val, struct expr_parse_ctx *ctx, > const char *expr, int runtime); > diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y > index 5a6e8b43fb08..ff5e5f6e170d 100644 > --- a/tools/perf/util/expr.y > +++ b/tools/perf/util/expr.y > @@ -71,7 +71,7 @@ all_other: all_other other > > other: ID > { > - expr__add_id(ctx, $1, 0.0); > + expr__add_val(ctx, $1, 0.0); > } > | > MIN | MAX | IF | ELSE | SMT_ON | NUMBER | '|' | '^' | '&' | '-' | '+' | '*' | '/' | '%' | '(' | ')' | ',' > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c > index 8fdef47005e6..0a991016f848 100644 > --- a/tools/perf/util/stat-shadow.c > +++ b/tools/perf/util/stat-shadow.c > @@ -773,9 +773,9 @@ static int prepare_metric(struct evsel **metric_events, > *pn = 0; > > if (metric_total) > - expr__add_id(pctx, n, metric_total); > + expr__add_val(pctx, n, metric_total); > else > - expr__add_id(pctx, n, avg_stats(stats)*scale); > + expr__add_val(pctx, n, avg_stats(stats)*scale); > } > > return i; > -- > 2.25.4 >