Re: [PATCH 1/9] perf python: add ui stubs file
On Tue, 30 Oct 2012 08:53:38 -0700, Arnaldo Carvalho de Melo wrote: > Em Tue, Oct 30, 2012 at 08:45:28AM -0600, David Ahern escreveu: >> On 10/30/12 1:24 AM, Namhyung Kim wrote: >> >On Mon, 29 Oct 2012 10:31:41 -0600, David Ahern wrote: >> >>stdio based implementations of ui_ based functions for the python >> >>library. Needed for patch 3 - consolidating open counters method. > >> >How about adding ui/util.c to the python-ext-sources? > >> Handles some of the ui_ functions, but still missing some >> symbols -- verbose, eprintf, ui__error_paranoid. The point of the >> python_stubs.c was a short term solution for the ui handlers. >> Arnaldo had some ideas on what is really needed. > > Yes, and that is something like what Namhyung did for perf_target, i.e. > don't call ui__ stuff from the evsel/evlist classes but use a > perf_evlist__strerror, merge perf_evlist__open_counters() with > perf_evlist__open(), use just perf_evlist__open() everywhere, so that > all tools get the fallbacks for features not present in older kernels, > etc. Yeah, it'd be better definitely. But the problem is we might emit warnings even in the internal fallback loop. Not sure how to handle it with this approach. Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/9] perf python: add ui stubs file
Em Tue, Oct 30, 2012 at 08:45:28AM -0600, David Ahern escreveu: > On 10/30/12 1:24 AM, Namhyung Kim wrote: > >On Mon, 29 Oct 2012 10:31:41 -0600, David Ahern wrote: > >>stdio based implementations of ui_ based functions for the python > >>library. Needed for patch 3 - consolidating open counters method. > >How about adding ui/util.c to the python-ext-sources? > Handles some of the ui_ functions, but still missing some > symbols -- verbose, eprintf, ui__error_paranoid. The point of the > python_stubs.c was a short term solution for the ui handlers. > Arnaldo had some ideas on what is really needed. Yes, and that is something like what Namhyung did for perf_target, i.e. don't call ui__ stuff from the evsel/evlist classes but use a perf_evlist__strerror, merge perf_evlist__open_counters() with perf_evlist__open(), use just perf_evlist__open() everywhere, so that all tools get the fallbacks for features not present in older kernels, etc. - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/9] perf python: add ui stubs file
On 10/30/12 1:24 AM, Namhyung Kim wrote: Hi David, On Mon, 29 Oct 2012 10:31:41 -0600, David Ahern wrote: stdio based implementations of ui_ based functions for the python library. Needed for patch 3 - consolidating open counters method. How about adding ui/util.c to the python-ext-sources? Handles some of the ui_ functions, but still missing some symbols -- verbose, eprintf, ui__error_paranoid. The point of the python_stubs.c was a short term solution for the ui handlers. Arnaldo had some ideas on what is really needed. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/9] perf python: add ui stubs file
Hi David, On Mon, 29 Oct 2012 10:31:41 -0600, David Ahern wrote: > stdio based implementations of ui_ based functions for the python > library. Needed for patch 3 - consolidating open counters method. How about adding ui/util.c to the python-ext-sources? Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/9] perf python: add ui stubs file
stdio based implementations of ui_ based functions for the python library. Needed for patch 3 - consolidating open counters method. Signed-off-by: David Ahern Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Frederic Weisbecker Cc: Peter Zijlstra --- tools/perf/util/python-ext-sources |1 + tools/perf/util/python_stubs.c | 54 2 files changed, 55 insertions(+) create mode 100644 tools/perf/util/python_stubs.c diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources index c40c2d3..92d9e05 100644 --- a/tools/perf/util/python-ext-sources +++ b/tools/perf/util/python-ext-sources @@ -19,3 +19,4 @@ util/debugfs.c util/rblist.c util/strlist.c ../../lib/rbtree.c +util/python_stubs.c diff --git a/tools/perf/util/python_stubs.c b/tools/perf/util/python_stubs.c new file mode 100644 index 000..7b31880 --- /dev/null +++ b/tools/perf/util/python_stubs.c @@ -0,0 +1,54 @@ +/* + * stubs for various ui-specific functions for the python library + */ + +#include +#include "debug.h" + +#if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT) +#undef ui__error +#endif + +int verbose; + +int ui__warning(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + return 0; +} + +int ui__error(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + return 0; +} + +int ui__error_paranoid(void) +{ + return ui__error("Permission error - are you root?\n" +"Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n" +" -1 - Not paranoid at all\n" +" 0 - Disallow raw tracepoint access for unpriv\n" +" 1 - Disallow cpu events for unpriv\n" +" 2 - Disallow kernel profiling for unpriv\n"); +} + +int eprintf(int level, const char *fmt, ...) +{ + va_list args; + int ret = 0; + + va_start(args, fmt); + ret = vfprintf(stderr, fmt, args); + va_end(args); + + return ret; +} -- 1.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/9] perf python: add ui stubs file
stderr based implementations of ui_ functions for the python library. Needed for patch 3 - consolidating open counters method. Signed-off-by: David Ahern Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Frederic Weisbecker Cc: Peter Zijlstra --- tools/perf/util/python-ext-sources |1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources index 2133628..8a45370 100644 --- a/tools/perf/util/python-ext-sources +++ b/tools/perf/util/python-ext-sources @@ -19,3 +19,4 @@ util/debugfs.c util/rblist.c util/strlist.c ../../lib/rbtree.c +util/ui_stubs.c -- 1.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/