Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1695274 > unrolled thread
| Started by | Andi Kleen <andi@firstfloor.org> |
|---|---|
| First post | 2017-07-25 01:50 +0200 |
| Last post | 2017-07-25 01:50 +0200 |
| Articles | 1 — 1 participant |
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 v1 09/15] perf, tools: Dedup events in expression parsing Andi Kleen <andi@firstfloor.org> - 2017-07-25 01:50 +0200
| From | Andi Kleen <andi@firstfloor.org> |
|---|---|
| Date | 2017-07-25 01:50 +0200 |
| Subject | [PATCH v1 09/15] perf, tools: Dedup events in expression parsing |
| Message-ID | <u6VgS-3zh-15@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.
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..f54928f00893 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 false;
+ 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
Back to top | Article view | linux.kernel
csiph-web