Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1710084 > unrolled thread
| Started by | Andi Kleen <andi@firstfloor.org> |
|---|---|
| First post | 2017-08-12 01:30 +0200 |
| Last post | 2017-08-24 10:30 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 10/19] perf, tools: Dedup events in expression parsing Andi Kleen <andi@firstfloor.org> - 2017-08-12 01:30 +0200
Re: [PATCH v2 10/19] perf, tools: Dedup events in expression parsing Jiri Olsa <jolsa@redhat.com> - 2017-08-22 10:50 +0200
[tip:perf/core] perf tools: Dedup events in expression parsing tip-bot for Andi Kleen <tipbot@zytor.com> - 2017-08-24 10:30 +0200
| From | Andi Kleen <andi@firstfloor.org> |
|---|---|
| Date | 2017-08-12 01:30 +0200 |
| Subject | [PATCH v2 10/19] perf, tools: Dedup events in expression parsing |
| Message-ID | <udrxo-1lO-13@gated-at.bofh.it> |
From: Andi Kleen <ak@linux.intel.com>
Avoid adding redundant events while parsing an expression.
When we add an "other" event check first if it already exists.
v2: Fix perf test failure.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/util/expr.y | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index 5753c4f21534..432b8560cf51 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -181,6 +181,19 @@ void expr__ctx_init(struct parse_ctx *ctx)
ctx->num_ids = 0;
}
+static bool already_seen(const char *val, const char *one, const char **other,
+ int num_other)
+{
+ int i;
+
+ if (one && !strcasecmp(one, val))
+ return true;
+ for (i = 0; i < num_other; i++)
+ if (!strcasecmp(other[i], val))
+ return true;
+ return false;
+}
+
int expr__find_other(const char *p, const char *one, const char ***other,
int *num_otherp)
{
@@ -200,7 +213,7 @@ int expr__find_other(const char *p, const char *one, const char ***other,
err = 0;
break;
}
- if (tok == ID && (!one || strcasecmp(one, val.id))) {
+ if (tok == ID && !already_seen(val.id, one, *other, num_other)) {
if (num_other >= EXPR_MAX_OTHER - 1) {
pr_debug("Too many extra events in %s\n", orig);
break;
--
2.9.4
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2017-08-22 10:50 +0200 |
| Message-ID | <uhd2N-8iT-9@gated-at.bofh.it> |
| In reply to | #1710084 |
On Fri, Aug 11, 2017 at 04:26:25PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Avoid adding redundant events while parsing an expression.
> When we add an "other" event check first if it already exists.
>
> v2: Fix perf test failure.
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
> ---
> tools/perf/util/expr.y | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
> index 5753c4f21534..432b8560cf51 100644
> --- a/tools/perf/util/expr.y
> +++ b/tools/perf/util/expr.y
> @@ -181,6 +181,19 @@ void expr__ctx_init(struct parse_ctx *ctx)
> ctx->num_ids = 0;
> }
>
> +static bool already_seen(const char *val, const char *one, const char **other,
> + int num_other)
> +{
> + int i;
> +
> + if (one && !strcasecmp(one, val))
> + return true;
> + for (i = 0; i < num_other; i++)
> + if (!strcasecmp(other[i], val))
> + return true;
> + return false;
> +}
> +
> int expr__find_other(const char *p, const char *one, const char ***other,
> int *num_otherp)
> {
> @@ -200,7 +213,7 @@ int expr__find_other(const char *p, const char *one, const char ***other,
> err = 0;
> break;
> }
> - if (tok == ID && (!one || strcasecmp(one, val.id))) {
> + if (tok == ID && !already_seen(val.id, one, *other, num_other)) {
> if (num_other >= EXPR_MAX_OTHER - 1) {
> pr_debug("Too many extra events in %s\n", orig);
> break;
> --
> 2.9.4
>
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Andi Kleen <tipbot@zytor.com> |
|---|---|
| Date | 2017-08-24 10:30 +0200 |
| Subject | [tip:perf/core] perf tools: Dedup events in expression parsing |
| Message-ID | <uhVGx-405-3@gated-at.bofh.it> |
| In reply to | #1710084 |
Commit-ID: d66dccdb13c9748f27d8401b45c027953fc833e8
Gitweb: http://git.kernel.org/tip/d66dccdb13c9748f27d8401b45c027953fc833e8
Author: Andi Kleen <ak@linux.intel.com>
AuthorDate: Fri, 11 Aug 2017 16:26:25 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 22 Aug 2017 12:19:08 -0300
perf tools: Dedup events in expression parsing
Avoid adding redundant events while parsing an expression. When we add
an "other" event check first if it already exists.
v2: Fix perf test failure.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20170811232634.30465-10-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/expr.y | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index 5753c4f..432b856 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -181,6 +181,19 @@ void expr__ctx_init(struct parse_ctx *ctx)
ctx->num_ids = 0;
}
+static bool already_seen(const char *val, const char *one, const char **other,
+ int num_other)
+{
+ int i;
+
+ if (one && !strcasecmp(one, val))
+ return true;
+ for (i = 0; i < num_other; i++)
+ if (!strcasecmp(other[i], val))
+ return true;
+ return false;
+}
+
int expr__find_other(const char *p, const char *one, const char ***other,
int *num_otherp)
{
@@ -200,7 +213,7 @@ int expr__find_other(const char *p, const char *one, const char ***other,
err = 0;
break;
}
- if (tok == ID && (!one || strcasecmp(one, val.id))) {
+ if (tok == ID && !already_seen(val.id, one, *other, num_other)) {
if (num_other >= EXPR_MAX_OTHER - 1) {
pr_debug("Too many extra events in %s\n", orig);
break;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web