* [PATCH -tip:perf/core 1/4] perf session: Remove impossible condition check
@ 2011-12-27 15:35 Namhyung Kim
2011-12-27 15:35 ` [PATCH -tip:perf/core 2/4] perf stat: Introduce get_ratio_color() helper Namhyung Kim
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Namhyung Kim @ 2011-12-27 15:35 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, linux-kernel
The 'size' cannot be 0 because it was set to 8 on the
above line in case it was 0 and never changed.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
tools/perf/util/session.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index d9318d8a9ba1..1139f3c6dec5 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1004,8 +1004,7 @@ more:
}
}
- if (size == 0 ||
- (skip = perf_session__process_event(self, &event, tool, head)) < 0) {
+ if ((skip = perf_session__process_event(self, &event, tool, head)) < 0) {
dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n",
head, event.header.size, event.header.type);
/*
--
1.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH -tip:perf/core 2/4] perf stat: Introduce get_ratio_color() helper 2011-12-27 15:35 [PATCH -tip:perf/core 1/4] perf session: Remove impossible condition check Namhyung Kim @ 2011-12-27 15:35 ` Namhyung Kim 2012-01-04 15:21 ` [tip:perf/core] " tip-bot for Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 3/4] perf top: Fix a memory leak Namhyung Kim ` (2 subsequent siblings) 3 siblings, 1 reply; 8+ messages in thread From: Namhyung Kim @ 2011-12-27 15:35 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, linux-kernel The get_ratio_color() returns appropriate color string based on @ratio. It helps reducing code duplication. Signed-off-by: Namhyung Kim <namhyung@gmail.com> --- tools/perf/builtin-stat.c | 91 +++++++++++++++++--------------------------- 1 files changed, 35 insertions(+), 56 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index cc53de335ced..f5d2a63eba66 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -578,6 +578,33 @@ static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg) avg / avg_stats(&walltime_nsecs_stats)); } +/* used for get_ratio_color() */ +enum grc_type { + GRC_STALLED_CYCLES_FE, + GRC_STALLED_CYCLES_BE, + GRC_CACHE_MISSES, + GRC_MAX_NR +}; + +static const char *get_ratio_color(enum grc_type type, double ratio) +{ + static const double grc_table[GRC_MAX_NR][3] = { + [GRC_STALLED_CYCLES_FE] = { 50.0, 30.0, 10.0 }, + [GRC_STALLED_CYCLES_BE] = { 75.0, 50.0, 20.0 }, + [GRC_CACHE_MISSES] = { 20.0, 10.0, 5.0 }, + }; + const char *color = PERF_COLOR_NORMAL; + + if (ratio > grc_table[type][0]) + color = PERF_COLOR_RED; + else if (ratio > grc_table[type][1]) + color = PERF_COLOR_MAGENTA; + else if (ratio > grc_table[type][2]) + color = PERF_COLOR_YELLOW; + + return color; +} + static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __used, double avg) { double total, ratio = 0.0; @@ -588,13 +615,7 @@ static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __us if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 50.0) - color = PERF_COLOR_RED; - else if (ratio > 30.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 10.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_STALLED_CYCLES_FE, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -611,13 +632,7 @@ static void print_stalled_cycles_backend(int cpu, struct perf_evsel *evsel __use if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 75.0) - color = PERF_COLOR_RED; - else if (ratio > 50.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 20.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -634,13 +649,7 @@ static void print_branch_misses(int cpu, struct perf_evsel *evsel __used, double if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -657,13 +666,7 @@ static void print_l1_dcache_misses(int cpu, struct perf_evsel *evsel __used, dou if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -680,13 +683,7 @@ static void print_l1_icache_misses(int cpu, struct perf_evsel *evsel __used, dou if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -703,13 +700,7 @@ static void print_dtlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -726,13 +717,7 @@ static void print_itlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -749,13 +734,7 @@ static void print_ll_cache_misses(int cpu, struct perf_evsel *evsel __used, doub if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); -- 1.7.6 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/core] perf stat: Introduce get_ratio_color() helper 2011-12-27 15:35 ` [PATCH -tip:perf/core 2/4] perf stat: Introduce get_ratio_color() helper Namhyung Kim @ 2012-01-04 15:21 ` tip-bot for Namhyung Kim 0 siblings, 0 replies; 8+ messages in thread From: tip-bot for Namhyung Kim @ 2012-01-04 15:21 UTC (permalink / raw) To: linux-tip-commits Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung, tglx, mingo Commit-ID: 15e6392feec311f1e409d77e1ccfe51c1d940365 Gitweb: http://git.kernel.org/tip/15e6392feec311f1e409d77e1ccfe51c1d940365 Author: Namhyung Kim <namhyung@gmail.com> AuthorDate: Wed, 28 Dec 2011 00:35:49 +0900 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Tue, 3 Jan 2012 14:36:32 -0200 perf stat: Introduce get_ratio_color() helper The get_ratio_color() returns appropriate color string based on @ratio. It helps reducing code duplication. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1325000151-4463-2-git-send-email-namhyung@gmail.com Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/builtin-stat.c | 91 +++++++++++++++++--------------------------- 1 files changed, 35 insertions(+), 56 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index cc53de3..f5d2a63 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -578,6 +578,33 @@ static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg) avg / avg_stats(&walltime_nsecs_stats)); } +/* used for get_ratio_color() */ +enum grc_type { + GRC_STALLED_CYCLES_FE, + GRC_STALLED_CYCLES_BE, + GRC_CACHE_MISSES, + GRC_MAX_NR +}; + +static const char *get_ratio_color(enum grc_type type, double ratio) +{ + static const double grc_table[GRC_MAX_NR][3] = { + [GRC_STALLED_CYCLES_FE] = { 50.0, 30.0, 10.0 }, + [GRC_STALLED_CYCLES_BE] = { 75.0, 50.0, 20.0 }, + [GRC_CACHE_MISSES] = { 20.0, 10.0, 5.0 }, + }; + const char *color = PERF_COLOR_NORMAL; + + if (ratio > grc_table[type][0]) + color = PERF_COLOR_RED; + else if (ratio > grc_table[type][1]) + color = PERF_COLOR_MAGENTA; + else if (ratio > grc_table[type][2]) + color = PERF_COLOR_YELLOW; + + return color; +} + static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __used, double avg) { double total, ratio = 0.0; @@ -588,13 +615,7 @@ static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __us if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 50.0) - color = PERF_COLOR_RED; - else if (ratio > 30.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 10.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_STALLED_CYCLES_FE, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -611,13 +632,7 @@ static void print_stalled_cycles_backend(int cpu, struct perf_evsel *evsel __use if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 75.0) - color = PERF_COLOR_RED; - else if (ratio > 50.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 20.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -634,13 +649,7 @@ static void print_branch_misses(int cpu, struct perf_evsel *evsel __used, double if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -657,13 +666,7 @@ static void print_l1_dcache_misses(int cpu, struct perf_evsel *evsel __used, dou if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -680,13 +683,7 @@ static void print_l1_icache_misses(int cpu, struct perf_evsel *evsel __used, dou if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -703,13 +700,7 @@ static void print_dtlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -726,13 +717,7 @@ static void print_itlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); @@ -749,13 +734,7 @@ static void print_ll_cache_misses(int cpu, struct perf_evsel *evsel __used, doub if (total) ratio = avg / total * 100.0; - color = PERF_COLOR_NORMAL; - if (ratio > 20.0) - color = PERF_COLOR_RED; - else if (ratio > 10.0) - color = PERF_COLOR_MAGENTA; - else if (ratio > 5.0) - color = PERF_COLOR_YELLOW; + color = get_ratio_color(GRC_CACHE_MISSES, ratio); fprintf(output, " # "); color_fprintf(output, color, "%6.2f%%", ratio); ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH -tip:perf/core 3/4] perf top: Fix a memory leak 2011-12-27 15:35 [PATCH -tip:perf/core 1/4] perf session: Remove impossible condition check Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 2/4] perf stat: Introduce get_ratio_color() helper Namhyung Kim @ 2011-12-27 15:35 ` Namhyung Kim 2012-01-04 15:21 ` [tip:perf/core] " tip-bot for Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 4/4] perf script: Kill script_spec__delete Namhyung Kim 2012-01-04 15:20 ` [tip:perf/core] perf session: Remove impossible condition check tip-bot for Namhyung Kim 3 siblings, 1 reply; 8+ messages in thread From: Namhyung Kim @ 2011-12-27 15:35 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, linux-kernel The 'buf' should be freed when symbol wasn't found too. Signed-off-by: Namhyung Kim <namhyung@gmail.com> --- tools/perf/builtin-top.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index c3836b966ccf..4f81eeb99875 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -351,7 +351,6 @@ static void perf_top__prompt_symbol(struct perf_top *top, const char *msg) if (!found) { fprintf(stderr, "Sorry, %s is not active.\n", buf); sleep(1); - return; } else perf_top__parse_source(top, found); -- 1.7.6 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/core] perf top: Fix a memory leak 2011-12-27 15:35 ` [PATCH -tip:perf/core 3/4] perf top: Fix a memory leak Namhyung Kim @ 2012-01-04 15:21 ` tip-bot for Namhyung Kim 0 siblings, 0 replies; 8+ messages in thread From: tip-bot for Namhyung Kim @ 2012-01-04 15:21 UTC (permalink / raw) To: linux-tip-commits Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung, tglx, mingo Commit-ID: 057a174a064f68bac042d618ce3c6ea3ccd9a8aa Gitweb: http://git.kernel.org/tip/057a174a064f68bac042d618ce3c6ea3ccd9a8aa Author: Namhyung Kim <namhyung@gmail.com> AuthorDate: Wed, 28 Dec 2011 00:35:50 +0900 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Tue, 3 Jan 2012 14:37:19 -0200 perf top: Fix a memory leak The 'buf' should be freed when symbol wasn't found too. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1325000151-4463-3-git-send-email-namhyung@gmail.com Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/builtin-top.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index c3836b9..4f81eeb 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -351,7 +351,6 @@ static void perf_top__prompt_symbol(struct perf_top *top, const char *msg) if (!found) { fprintf(stderr, "Sorry, %s is not active.\n", buf); sleep(1); - return; } else perf_top__parse_source(top, found); ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH -tip:perf/core 4/4] perf script: Kill script_spec__delete 2011-12-27 15:35 [PATCH -tip:perf/core 1/4] perf session: Remove impossible condition check Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 2/4] perf stat: Introduce get_ratio_color() helper Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 3/4] perf top: Fix a memory leak Namhyung Kim @ 2011-12-27 15:35 ` Namhyung Kim 2012-01-04 15:22 ` [tip:perf/core] " tip-bot for Namhyung Kim 2012-01-04 15:20 ` [tip:perf/core] perf session: Remove impossible condition check tip-bot for Namhyung Kim 3 siblings, 1 reply; 8+ messages in thread From: Namhyung Kim @ 2011-12-27 15:35 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, linux-kernel As script_spec__delete() frees given struct script_spec it should not be called if we failed to allocate the struct. Also it's the only caller of the function, we can get rid of the function itself. Signed-off-by: Namhyung Kim <namhyung@gmail.com> --- tools/perf/builtin-script.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index ea71c5e1a94f..d9c049e98a58 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -536,12 +536,6 @@ static struct script_spec *script_spec__new(const char *spec, return s; } -static void script_spec__delete(struct script_spec *s) -{ - free(s->spec); - free(s); -} - static void script_spec__add(struct script_spec *s) { list_add_tail(&s->node, &script_specs); @@ -567,16 +561,11 @@ static struct script_spec *script_spec__findnew(const char *spec, s = script_spec__new(spec, ops); if (!s) - goto out_delete_spec; + return NULL; script_spec__add(s); return s; - -out_delete_spec: - script_spec__delete(s); - - return NULL; } int script_spec_register(const char *spec, struct scripting_ops *ops) -- 1.7.6 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/core] perf script: Kill script_spec__delete 2011-12-27 15:35 ` [PATCH -tip:perf/core 4/4] perf script: Kill script_spec__delete Namhyung Kim @ 2012-01-04 15:22 ` tip-bot for Namhyung Kim 0 siblings, 0 replies; 8+ messages in thread From: tip-bot for Namhyung Kim @ 2012-01-04 15:22 UTC (permalink / raw) To: linux-tip-commits Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung, tglx, mingo Commit-ID: 466e2876bcb9ddc9b92502c46689679bee7d72a0 Gitweb: http://git.kernel.org/tip/466e2876bcb9ddc9b92502c46689679bee7d72a0 Author: Namhyung Kim <namhyung@gmail.com> AuthorDate: Wed, 28 Dec 2011 00:35:51 +0900 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Tue, 3 Jan 2012 15:06:34 -0200 perf script: Kill script_spec__delete As script_spec__delete() frees given struct script_spec it should not be called if we failed to allocate the struct. Also it's the only caller of the function, we can get rid of the function itself. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1325000151-4463-4-git-send-email-namhyung@gmail.com Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/builtin-script.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 3d4c0c7..fd1909a 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -536,12 +536,6 @@ static struct script_spec *script_spec__new(const char *spec, return s; } -static void script_spec__delete(struct script_spec *s) -{ - free(s->spec); - free(s); -} - static void script_spec__add(struct script_spec *s) { list_add_tail(&s->node, &script_specs); @@ -567,16 +561,11 @@ static struct script_spec *script_spec__findnew(const char *spec, s = script_spec__new(spec, ops); if (!s) - goto out_delete_spec; + return NULL; script_spec__add(s); return s; - -out_delete_spec: - script_spec__delete(s); - - return NULL; } int script_spec_register(const char *spec, struct scripting_ops *ops) ^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/core] perf session: Remove impossible condition check 2011-12-27 15:35 [PATCH -tip:perf/core 1/4] perf session: Remove impossible condition check Namhyung Kim ` (2 preceding siblings ...) 2011-12-27 15:35 ` [PATCH -tip:perf/core 4/4] perf script: Kill script_spec__delete Namhyung Kim @ 2012-01-04 15:20 ` tip-bot for Namhyung Kim 3 siblings, 0 replies; 8+ messages in thread From: tip-bot for Namhyung Kim @ 2012-01-04 15:20 UTC (permalink / raw) To: linux-tip-commits Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung, tglx, mingo Commit-ID: 29c9862f1b818bf4caa4c48a30dbe5f25c84ee08 Gitweb: http://git.kernel.org/tip/29c9862f1b818bf4caa4c48a30dbe5f25c84ee08 Author: Namhyung Kim <namhyung@gmail.com> AuthorDate: Wed, 28 Dec 2011 00:35:48 +0900 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Tue, 3 Jan 2012 14:35:02 -0200 perf session: Remove impossible condition check The 'size' cannot be 0 because it was set to 8 on the above line in case it was 0 and never changed. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1325000151-4463-1-git-send-email-namhyung@gmail.com Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/util/session.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index cc5e6be..b5ca255 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1015,8 +1015,7 @@ more: } } - if (size == 0 || - (skip = perf_session__process_event(self, &event, tool, head)) < 0) { + if ((skip = perf_session__process_event(self, &event, tool, head)) < 0) { dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n", head, event.header.size, event.header.type); /* ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-01-04 15:23 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-12-27 15:35 [PATCH -tip:perf/core 1/4] perf session: Remove impossible condition check Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 2/4] perf stat: Introduce get_ratio_color() helper Namhyung Kim 2012-01-04 15:21 ` [tip:perf/core] " tip-bot for Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 3/4] perf top: Fix a memory leak Namhyung Kim 2012-01-04 15:21 ` [tip:perf/core] " tip-bot for Namhyung Kim 2011-12-27 15:35 ` [PATCH -tip:perf/core 4/4] perf script: Kill script_spec__delete Namhyung Kim 2012-01-04 15:22 ` [tip:perf/core] " tip-bot for Namhyung Kim 2012-01-04 15:20 ` [tip:perf/core] perf session: Remove impossible condition check tip-bot for Namhyung Kim
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome