2012-10-01 13:54:41

by Namhyung Kim

[permalink] [raw]
Subject: Re: [PATCH 11/12] perf tools: Convert to BACKTRACE_SUPPORT

2012-10-01 (월), 02:40 +0300, Irina Tirdea:
> > @@ -751,10 +753,8 @@ else
> > endif
> >
> > ifdef NO_BACKTRACE

Argh, right. Thanks for pointing it out. I double checked other ones
too, and it seems that they don't have the problem.

Arnaldo, what do you want to do with this?

Thanks,
Namhyung


2012-10-01 14:24:54

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 11/12] perf tools: Convert to BACKTRACE_SUPPORT

Em Mon, Oct 01, 2012 at 10:54:33PM +0900, Namhyung Kim escreveu:
> 2012-10-01 (월), 02:40 +0300, Irina Tirdea:
> > > @@ -751,10 +753,8 @@ else
> > > endif
> > >
> > > ifdef NO_BACKTRACE
>
> Argh, right. Thanks for pointing it out. I double checked other ones
> too, and it seems that they don't have the problem.
>
> Arnaldo, what do you want to do with this?

Just resubmit this one, I removed it from my local tree, where I have
the others applied.

> Thanks,
> Namhyung
>

2012-10-01 16:33:06

by Namhyung Kim

[permalink] [raw]
Subject: [PATCH v2 11/12] perf tools: Convert to BACKTRACE_SUPPORT

From: Namhyung Kim <[email protected]>

For building perf without stack backtrace debug, we can set
NO_BACKTRACE=1 as a argument of make. It then defines NO_BACKTRACE
macro for C code to do the proper handling. However it usually used
in a negative semantics - e.g. #ifndef - so we saw double negations
which can be misleading. Convert it to a positive form to make it
more readable and add _SUPPORT suffix for consistency.

Cc: Irina Tirdea <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
---
tools/perf/Makefile | 10 +++++-----
tools/perf/util/util.c | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index dd5b9a0507c7..6b3ed863023b 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -45,6 +45,8 @@ include config/utilities.mak
#
# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
# backtrace post unwind.
+#
+# Define NO_BACKTRACE if you do not want stack backtrace debug feature

$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -750,11 +752,9 @@ else
endif
endif

-ifdef NO_BACKTRACE
- BASIC_CFLAGS += -DNO_BACKTRACE
-else
- ifneq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
- BASIC_CFLAGS += -DNO_BACKTRACE
+ifndef NO_BACKTRACE
+ ifeq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
+ BASIC_CFLAGS += -DBACKTRACE_SUPPORT
endif
endif

diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 2055cf38041c..99664598bc1a 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,7 +1,7 @@
#include "../perf.h"
#include "util.h"
#include <sys/mman.h>
-#ifndef NO_BACKTRACE
+#ifdef BACKTRACE_SUPPORT
#include <execinfo.h>
#endif
#include <stdio.h>
@@ -165,7 +165,7 @@ size_t hex_width(u64 v)
}

/* Obtain a backtrace and print it to stdout. */
-#ifndef NO_BACKTRACE
+#ifdef BACKTRACE_SUPPORT
void dump_stack(void)
{
void *array[16];
--
1.7.9.2

2012-10-05 08:55:58

by Namhyung Kim

[permalink] [raw]
Subject: [tip:perf/urgent] perf tools: Convert to BACKTRACE_SUPPORT

Commit-ID: 4e34d9588b46f44a4dba718606913133f15e4b21
Gitweb: http://git.kernel.org/tip/4e34d9588b46f44a4dba718606913133f15e4b21
Author: Namhyung Kim <[email protected]>
AuthorDate: Tue, 2 Oct 2012 01:32:51 +0900
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 2 Oct 2012 18:36:45 -0300

perf tools: Convert to BACKTRACE_SUPPORT

For building perf without stack backtrace debug, we can set
NO_BACKTRACE=1 as a argument of make. It then defines NO_BACKTRACE
macro for C code to do the proper handling. However it usually used in
a negative semantics - e.g. #ifndef - so we saw double negations which
can be misleading. Convert it to a positive form to make it more
readable and add _SUPPORT suffix for consistency.

Signed-off-by: Namhyung Kim <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Irina Tirdea <[email protected]>
Cc: Irina Tirdea <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile | 10 +++++-----
tools/perf/util/util.c | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5216ade..f9126f8 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -45,6 +45,8 @@ include config/utilities.mak
#
# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
# backtrace post unwind.
+#
+# Define NO_BACKTRACE if you do not want stack backtrace debug feature

$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -749,11 +751,9 @@ ifndef NO_STRLCPY
endif
endif

-ifdef NO_BACKTRACE
- BASIC_CFLAGS += -DNO_BACKTRACE
-else
- ifneq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
- BASIC_CFLAGS += -DNO_BACKTRACE
+ifndef NO_BACKTRACE
+ ifeq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
+ BASIC_CFLAGS += -DBACKTRACE_SUPPORT
endif
endif

diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 2055cf3..9966459 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,7 +1,7 @@
#include "../perf.h"
#include "util.h"
#include <sys/mman.h>
-#ifndef NO_BACKTRACE
+#ifdef BACKTRACE_SUPPORT
#include <execinfo.h>
#endif
#include <stdio.h>
@@ -165,7 +165,7 @@ size_t hex_width(u64 v)
}

/* Obtain a backtrace and print it to stdout. */
-#ifndef NO_BACKTRACE
+#ifdef BACKTRACE_SUPPORT
void dump_stack(void)
{
void *array[16];