Tom Zanussi (4):
perf trace/scripting: silence PERL_EMBED_* backtick errors
perf trace/scripting: ignore shadowed variable warning for
perf-trace-perl.c
perf trace/scripting: fix Perl common_* access functions
perf trace/scripting: Add Fedora libperl install note to doc
tools/perf/Makefile | 6 ++--
tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 30 ++++++++++----------
tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 6 ++--
tools/perf/scripts/perl/Perf-Trace-Util/README | 4 +-
tools/perf/util/trace-event-perl.c | 10 ++++--
tools/perf/util/trace-event-perl.h | 6 ++--
6 files changed, 32 insertions(+), 30 deletions(-)
The backtick shell substitutions for PERL_EMBED_LDOPT/CCOPT make a lot
of noise on stderr if Embed.pm isn't installed - this silences them.
Signed-off-by: Tom Zanussi <[email protected]>
---
tools/perf/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 8ad57b5..d62a2d7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -490,8 +490,8 @@ else
LIB_OBJS += util/probe-finder.o
endif
-PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts`
-PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts`
+PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
+PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o /dev/null $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
BASIC_CFLAGS += -DNO_LIBPERL
--
1.6.4.GIT
The debugging versions of the ENTER and LEAVE internal perl macros,
used when embedding perl, define a local block with a my_perl perl
variable that shadows a global variable of the same name, which is
also the name expected by the embedding API for the embedded
interpreter. Since we don't have control over the code generated in
this case and can't get rid of the warning, ignore it.
Signed-off-by: Tom Zanussi <[email protected]>
---
tools/perf/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d62a2d7..20cd663 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -872,7 +872,7 @@ util/find_next_bit.o: ../../lib/find_next_bit.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o util/find_next_bit.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
util/trace-event-perl.o: util/trace-event-perl.c PERF-CFLAGS
- $(QUIET_CC)$(CC) -o util/trace-event-perl.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter $<
+ $(QUIET_CC)$(CC) -o util/trace-event-perl.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o scripts/perl/Perf-Trace-Util/Context.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
--
1.6.4.GIT
The common_* functions (e.g. common_pc(), etc) are exported as
common_* but named get_common_*, resulting in unresolved subroutine
errors when executing scripts. Make the internal and external names
match.
Signed-off-by: Tom Zanussi <[email protected]>
---
tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 30 ++++++++++----------
tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 6 ++--
tools/perf/util/trace-event-perl.c | 6 ++--
tools/perf/util/trace-event-perl.h | 6 ++--
4 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
index 3ba3ffc..af78d9a 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
@@ -39,8 +39,8 @@
#line 41 "Context.c"
-XS(XS_Perf__Trace__Context_get_common_pc); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Perf__Trace__Context_get_common_pc)
+XS(XS_Perf__Trace__Context_common_pc); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Perf__Trace__Context_common_pc)
{
#ifdef dVAR
dVAR; dXSARGS;
@@ -48,22 +48,22 @@ XS(XS_Perf__Trace__Context_get_common_pc)
dXSARGS;
#endif
if (items != 1)
- Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::get_common_pc", "context");
+ Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::common_pc", "context");
PERL_UNUSED_VAR(cv); /* -W */
{
struct scripting_context * context = INT2PTR(struct scripting_context *,SvIV(ST(0)));
int RETVAL;
dXSTARG;
- RETVAL = get_common_pc(context);
+ RETVAL = common_pc(context);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
-XS(XS_Perf__Trace__Context_get_common_flags); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Perf__Trace__Context_get_common_flags)
+XS(XS_Perf__Trace__Context_common_flags); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Perf__Trace__Context_common_flags)
{
#ifdef dVAR
dVAR; dXSARGS;
@@ -71,22 +71,22 @@ XS(XS_Perf__Trace__Context_get_common_flags)
dXSARGS;
#endif
if (items != 1)
- Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::get_common_flags", "context");
+ Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::common_flags", "context");
PERL_UNUSED_VAR(cv); /* -W */
{
struct scripting_context * context = INT2PTR(struct scripting_context *,SvIV(ST(0)));
int RETVAL;
dXSTARG;
- RETVAL = get_common_flags(context);
+ RETVAL = common_flags(context);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
-XS(XS_Perf__Trace__Context_get_common_lock_depth); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Perf__Trace__Context_get_common_lock_depth)
+XS(XS_Perf__Trace__Context_common_lock_depth); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Perf__Trace__Context_common_lock_depth)
{
#ifdef dVAR
dVAR; dXSARGS;
@@ -94,14 +94,14 @@ XS(XS_Perf__Trace__Context_get_common_lock_depth)
dXSARGS;
#endif
if (items != 1)
- Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::get_common_lock_depth", "context");
+ Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::common_lock_depth", "context");
PERL_UNUSED_VAR(cv); /* -W */
{
struct scripting_context * context = INT2PTR(struct scripting_context *,SvIV(ST(0)));
int RETVAL;
dXSTARG;
- RETVAL = get_common_lock_depth(context);
+ RETVAL = common_lock_depth(context);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
@@ -124,9 +124,9 @@ XS(boot_Perf__Trace__Context)
PERL_UNUSED_VAR(items); /* -W */
XS_VERSION_BOOTCHECK ;
- newXSproto("Perf::Trace::Context::get_common_pc", XS_Perf__Trace__Context_get_common_pc, file, "$");
- newXSproto("Perf::Trace::Context::get_common_flags", XS_Perf__Trace__Context_get_common_flags, file, "$");
- newXSproto("Perf::Trace::Context::get_common_lock_depth", XS_Perf__Trace__Context_get_common_lock_depth, file, "$");
+ newXSproto("Perf::Trace::Context::common_pc", XS_Perf__Trace__Context_common_pc, file, "$");
+ newXSproto("Perf::Trace::Context::common_flags", XS_Perf__Trace__Context_common_flags, file, "$");
+ newXSproto("Perf::Trace::Context::common_lock_depth", XS_Perf__Trace__Context_common_lock_depth, file, "$");
if (PL_unitcheckav)
call_list(PL_scopestack_ix, PL_unitcheckav);
XSRETURN_YES;
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
index 24facb3..fb78006 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
@@ -28,14 +28,14 @@ MODULE = Perf::Trace::Context PACKAGE = Perf::Trace::Context
PROTOTYPES: ENABLE
int
-get_common_pc(context)
+common_pc(context)
struct scripting_context * context
int
-get_common_flags(context)
+common_flags(context)
struct scripting_context * context
int
-get_common_lock_depth(context)
+common_lock_depth(context)
struct scripting_context * context
diff --git a/tools/perf/util/trace-event-perl.c b/tools/perf/util/trace-event-perl.c
index d179ade..2e1cc3c 100644
--- a/tools/perf/util/trace-event-perl.c
+++ b/tools/perf/util/trace-event-perl.c
@@ -242,7 +242,7 @@ static inline struct event *find_cache_event(int type)
return event;
}
-int get_common_pc(struct scripting_context *context)
+int common_pc(struct scripting_context *context)
{
int pc;
@@ -251,7 +251,7 @@ int get_common_pc(struct scripting_context *context)
return pc;
}
-int get_common_flags(struct scripting_context *context)
+int common_flags(struct scripting_context *context)
{
int flags;
@@ -260,7 +260,7 @@ int get_common_flags(struct scripting_context *context)
return flags;
}
-int get_common_lock_depth(struct scripting_context *context)
+int common_lock_depth(struct scripting_context *context)
{
int lock_depth;
diff --git a/tools/perf/util/trace-event-perl.h b/tools/perf/util/trace-event-perl.h
index 666a864..8fe0d86 100644
--- a/tools/perf/util/trace-event-perl.h
+++ b/tools/perf/util/trace-event-perl.h
@@ -44,8 +44,8 @@ struct scripting_context {
void *event_data;
};
-int get_common_pc(struct scripting_context *context);
-int get_common_flags(struct scripting_context *context);
-int get_common_lock_depth(struct scripting_context *context);
+int common_pc(struct scripting_context *context);
+int common_flags(struct scripting_context *context);
+int common_lock_depth(struct scripting_context *context);
#endif /* __PERF_TRACE_EVENT_PERL_H */
--
1.6.4.GIT
Fedora needs perl-ExtUtils-Embed for Perl scripting, which also brings
along libperl-devel; note this info for the convenience of Fedora
users.
Signed-off-by: Tom Zanussi <[email protected]>
---
tools/perf/scripts/perl/Perf-Trace-Util/README | 4 ++--
tools/perf/util/trace-event-perl.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/README b/tools/perf/scripts/perl/Perf-Trace-Util/README
index adb99aa..9a97076 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/README
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/README
@@ -36,8 +36,8 @@ INSTALLATION
Building perf with perf trace Perl scripting should install this
module in the right place.
-You should make sure libperl is installed first e.g. apt-get install
-libperl-dev.
+You should make sure libperl and ExtUtils/Embed.pm are installed first
+e.g. apt-get install libperl-dev or yum install perl-ExtUtils-Embed.
DEPENDENCIES
diff --git a/tools/perf/util/trace-event-perl.c b/tools/perf/util/trace-event-perl.c
index 2e1cc3c..51e833f 100644
--- a/tools/perf/util/trace-event-perl.c
+++ b/tools/perf/util/trace-event-perl.c
@@ -577,7 +577,9 @@ struct scripting_ops perl_scripting_ops = {
void setup_perl_scripting(void)
{
fprintf(stderr, "Perl scripting not supported."
- " Install libperl-dev[el] and rebuild perf to get it.\n");
+ " Install libperl and rebuild perf to enable it. e.g. "
+ "apt-get install libperl-dev (ubuntu), yum install "
+ "perl-ExtUtils-Embed (Fedora), etc.\n");
}
#else
void setup_perl_scripting(void)
--
1.6.4.GIT
* Tom Zanussi <[email protected]> wrote:
> Tom Zanussi (4):
> perf trace/scripting: silence PERL_EMBED_* backtick errors
> perf trace/scripting: ignore shadowed variable warning for
> perf-trace-perl.c
> perf trace/scripting: fix Perl common_* access functions
> perf trace/scripting: Add Fedora libperl install note to doc
>
> tools/perf/Makefile | 6 ++--
> tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 30 ++++++++++----------
> tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 6 ++--
> tools/perf/scripts/perl/Perf-Trace-Util/README | 4 +-
> tools/perf/util/trace-event-perl.c | 10 ++++--
> tools/perf/util/trace-event-perl.h | 6 ++--
> 6 files changed, 32 insertions(+), 30 deletions(-)
Applied, thanks Tom!
I tried a few simple things and it worked fine, so i put it into the
permanent perf/scripting branch. I think this looks like a nice feature:
a perfect fit to do rapid prototyping of tracing applets. (or just to
use it for ad-hoc, programming based analysis of tracing data)
There's a few odd ends to 'perf trace' usability we need to fix before
this can be merged into perf/core. For example if libperl isnt
installed, 'perf trace' emits this warning:
Perl scripting not supported. Install libperl and rebuild perf to
enable it. e.g. apt-get install libperl-dev (ubuntu), yum install
perl-ExtUtils-Embed (Fedora), etc.
We should only emit that if -g or -s is used - it's a nuisance in the
other cases. Most distributions dont have libperl installed by default.
Also, a few simple examples and some heads-up about the power of
scripting should be put into Documentation/perf-trace.txt as well.
Something minimal - and it can include a Perl example as well. Some
practical version of perl/Perf-Trace-Util/README or so. We want curious
people who know Perl and try 'perf trace --help' to have some minimal
entry vector into this space.
A third question is - right now we install the sample Perl scripts on
'make install', but there's no mechanism to see the scripts that are
available. 'perf trace -l/--list' might be useful?
I.e. the whole pathway of random perf users coming in and starting to
use the script engine 'spontaneusly' and 'intuitively' is not yet
thought through - the capabilities are hidden too much.
Thanks,
Ingo
Commit-ID: f8be4231f82ab56a87ce74906671afbe1aa9ec75
Gitweb: http://git.kernel.org/tip/f8be4231f82ab56a87ce74906671afbe1aa9ec75
Author: Tom Zanussi <[email protected]>
AuthorDate: Mon, 30 Nov 2009 01:18:46 -0600
Committer: Ingo Molnar <[email protected]>
CommitDate: Mon, 30 Nov 2009 09:03:59 +0100
perf trace/scripting: Silence PERL_EMBED_* backtick errors
The backtick shell substitutions for PERL_EMBED_LDOPT/CCOPT make
a lot of noise on stderr if Embed.pm isn't installed - this
silences them.
Signed-off-by: Tom Zanussi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
tools/perf/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 8ad57b5..d62a2d7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -490,8 +490,8 @@ else
LIB_OBJS += util/probe-finder.o
endif
-PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts`
-PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts`
+PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
+PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o /dev/null $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
BASIC_CFLAGS += -DNO_LIBPERL
Commit-ID: e136323c5a8a7d91d17c5b7b340758bb9dd33739
Gitweb: http://git.kernel.org/tip/e136323c5a8a7d91d17c5b7b340758bb9dd33739
Author: Tom Zanussi <[email protected]>
AuthorDate: Mon, 30 Nov 2009 01:18:47 -0600
Committer: Ingo Molnar <[email protected]>
CommitDate: Mon, 30 Nov 2009 09:04:00 +0100
perf trace/scripting: Ignore shadowed variable warning for perf-trace-perl.c
The debugging versions of the ENTER and LEAVE internal perl
macros, used when embedding perl, define a local block with a
my_perl perl variable that shadows a global variable of the same
name, which is also the name expected by the embedding API for
the embedded interpreter.
Since we don't have control over the code generated in this case
(it's an externality) and can't get rid of the warning, ignore it.
Signed-off-by: Tom Zanussi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
tools/perf/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d62a2d7..20cd663 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -872,7 +872,7 @@ util/find_next_bit.o: ../../lib/find_next_bit.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o util/find_next_bit.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
util/trace-event-perl.o: util/trace-event-perl.c PERF-CFLAGS
- $(QUIET_CC)$(CC) -o util/trace-event-perl.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter $<
+ $(QUIET_CC)$(CC) -o util/trace-event-perl.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o scripts/perl/Perf-Trace-Util/Context.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
Commit-ID: 61381de0504181368672a83d2e14c38dbaf3c136
Gitweb: http://git.kernel.org/tip/61381de0504181368672a83d2e14c38dbaf3c136
Author: Tom Zanussi <[email protected]>
AuthorDate: Mon, 30 Nov 2009 01:18:48 -0600
Committer: Ingo Molnar <[email protected]>
CommitDate: Mon, 30 Nov 2009 09:04:00 +0100
perf trace/scripting: Fix Perl common_* access functions
The common_* functions (e.g. common_pc(), etc) are exported as
common_* but named get_common_*, resulting in unresolved
subroutine errors when executing scripts.
Make the internal and external names match.
Signed-off-by: Tom Zanussi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 30 ++++++++++----------
tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 6 ++--
tools/perf/util/trace-event-perl.c | 6 ++--
tools/perf/util/trace-event-perl.h | 6 ++--
4 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
index 3ba3ffc..af78d9a 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
@@ -39,8 +39,8 @@
#line 41 "Context.c"
-XS(XS_Perf__Trace__Context_get_common_pc); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Perf__Trace__Context_get_common_pc)
+XS(XS_Perf__Trace__Context_common_pc); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Perf__Trace__Context_common_pc)
{
#ifdef dVAR
dVAR; dXSARGS;
@@ -48,22 +48,22 @@ XS(XS_Perf__Trace__Context_get_common_pc)
dXSARGS;
#endif
if (items != 1)
- Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::get_common_pc", "context");
+ Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::common_pc", "context");
PERL_UNUSED_VAR(cv); /* -W */
{
struct scripting_context * context = INT2PTR(struct scripting_context *,SvIV(ST(0)));
int RETVAL;
dXSTARG;
- RETVAL = get_common_pc(context);
+ RETVAL = common_pc(context);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
-XS(XS_Perf__Trace__Context_get_common_flags); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Perf__Trace__Context_get_common_flags)
+XS(XS_Perf__Trace__Context_common_flags); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Perf__Trace__Context_common_flags)
{
#ifdef dVAR
dVAR; dXSARGS;
@@ -71,22 +71,22 @@ XS(XS_Perf__Trace__Context_get_common_flags)
dXSARGS;
#endif
if (items != 1)
- Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::get_common_flags", "context");
+ Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::common_flags", "context");
PERL_UNUSED_VAR(cv); /* -W */
{
struct scripting_context * context = INT2PTR(struct scripting_context *,SvIV(ST(0)));
int RETVAL;
dXSTARG;
- RETVAL = get_common_flags(context);
+ RETVAL = common_flags(context);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
-XS(XS_Perf__Trace__Context_get_common_lock_depth); /* prototype to pass -Wmissing-prototypes */
-XS(XS_Perf__Trace__Context_get_common_lock_depth)
+XS(XS_Perf__Trace__Context_common_lock_depth); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Perf__Trace__Context_common_lock_depth)
{
#ifdef dVAR
dVAR; dXSARGS;
@@ -94,14 +94,14 @@ XS(XS_Perf__Trace__Context_get_common_lock_depth)
dXSARGS;
#endif
if (items != 1)
- Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::get_common_lock_depth", "context");
+ Perl_croak(aTHX_ "Usage: %s(%s)", "Perf::Trace::Context::common_lock_depth", "context");
PERL_UNUSED_VAR(cv); /* -W */
{
struct scripting_context * context = INT2PTR(struct scripting_context *,SvIV(ST(0)));
int RETVAL;
dXSTARG;
- RETVAL = get_common_lock_depth(context);
+ RETVAL = common_lock_depth(context);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
@@ -124,9 +124,9 @@ XS(boot_Perf__Trace__Context)
PERL_UNUSED_VAR(items); /* -W */
XS_VERSION_BOOTCHECK ;
- newXSproto("Perf::Trace::Context::get_common_pc", XS_Perf__Trace__Context_get_common_pc, file, "$");
- newXSproto("Perf::Trace::Context::get_common_flags", XS_Perf__Trace__Context_get_common_flags, file, "$");
- newXSproto("Perf::Trace::Context::get_common_lock_depth", XS_Perf__Trace__Context_get_common_lock_depth, file, "$");
+ newXSproto("Perf::Trace::Context::common_pc", XS_Perf__Trace__Context_common_pc, file, "$");
+ newXSproto("Perf::Trace::Context::common_flags", XS_Perf__Trace__Context_common_flags, file, "$");
+ newXSproto("Perf::Trace::Context::common_lock_depth", XS_Perf__Trace__Context_common_lock_depth, file, "$");
if (PL_unitcheckav)
call_list(PL_scopestack_ix, PL_unitcheckav);
XSRETURN_YES;
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
index 24facb3..fb78006 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
@@ -28,14 +28,14 @@ MODULE = Perf::Trace::Context PACKAGE = Perf::Trace::Context
PROTOTYPES: ENABLE
int
-get_common_pc(context)
+common_pc(context)
struct scripting_context * context
int
-get_common_flags(context)
+common_flags(context)
struct scripting_context * context
int
-get_common_lock_depth(context)
+common_lock_depth(context)
struct scripting_context * context
diff --git a/tools/perf/util/trace-event-perl.c b/tools/perf/util/trace-event-perl.c
index d179ade..2e1cc3c 100644
--- a/tools/perf/util/trace-event-perl.c
+++ b/tools/perf/util/trace-event-perl.c
@@ -242,7 +242,7 @@ static inline struct event *find_cache_event(int type)
return event;
}
-int get_common_pc(struct scripting_context *context)
+int common_pc(struct scripting_context *context)
{
int pc;
@@ -251,7 +251,7 @@ int get_common_pc(struct scripting_context *context)
return pc;
}
-int get_common_flags(struct scripting_context *context)
+int common_flags(struct scripting_context *context)
{
int flags;
@@ -260,7 +260,7 @@ int get_common_flags(struct scripting_context *context)
return flags;
}
-int get_common_lock_depth(struct scripting_context *context)
+int common_lock_depth(struct scripting_context *context)
{
int lock_depth;
diff --git a/tools/perf/util/trace-event-perl.h b/tools/perf/util/trace-event-perl.h
index 666a864..8fe0d86 100644
--- a/tools/perf/util/trace-event-perl.h
+++ b/tools/perf/util/trace-event-perl.h
@@ -44,8 +44,8 @@ struct scripting_context {
void *event_data;
};
-int get_common_pc(struct scripting_context *context);
-int get_common_flags(struct scripting_context *context);
-int get_common_lock_depth(struct scripting_context *context);
+int common_pc(struct scripting_context *context);
+int common_flags(struct scripting_context *context);
+int common_lock_depth(struct scripting_context *context);
#endif /* __PERF_TRACE_EVENT_PERL_H */
Commit-ID: 8ea339adc0a48236008e59dd21564d71c37b331c
Gitweb: http://git.kernel.org/tip/8ea339adc0a48236008e59dd21564d71c37b331c
Author: Tom Zanussi <[email protected]>
AuthorDate: Mon, 30 Nov 2009 01:18:49 -0600
Committer: Ingo Molnar <[email protected]>
CommitDate: Mon, 30 Nov 2009 09:04:01 +0100
perf trace/scripting: Add Fedora libperl install note to doc
Fedora needs perl-ExtUtils-Embed for Perl scripting, which also
brings along libperl-devel; note this info for the convenience
of Fedora users.
Signed-off-by: Tom Zanussi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
tools/perf/scripts/perl/Perf-Trace-Util/README | 4 ++--
tools/perf/util/trace-event-perl.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/README b/tools/perf/scripts/perl/Perf-Trace-Util/README
index adb99aa..9a97076 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/README
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/README
@@ -36,8 +36,8 @@ INSTALLATION
Building perf with perf trace Perl scripting should install this
module in the right place.
-You should make sure libperl is installed first e.g. apt-get install
-libperl-dev.
+You should make sure libperl and ExtUtils/Embed.pm are installed first
+e.g. apt-get install libperl-dev or yum install perl-ExtUtils-Embed.
DEPENDENCIES
diff --git a/tools/perf/util/trace-event-perl.c b/tools/perf/util/trace-event-perl.c
index 2e1cc3c..51e833f 100644
--- a/tools/perf/util/trace-event-perl.c
+++ b/tools/perf/util/trace-event-perl.c
@@ -577,7 +577,9 @@ struct scripting_ops perl_scripting_ops = {
void setup_perl_scripting(void)
{
fprintf(stderr, "Perl scripting not supported."
- " Install libperl-dev[el] and rebuild perf to get it.\n");
+ " Install libperl and rebuild perf to enable it. e.g. "
+ "apt-get install libperl-dev (ubuntu), yum install "
+ "perl-ExtUtils-Embed (Fedora), etc.\n");
}
#else
void setup_perl_scripting(void)
On Mon, 2009-11-30 at 09:19 +0100, Ingo Molnar wrote:
> * Tom Zanussi <[email protected]> wrote:
>
> > Tom Zanussi (4):
> > perf trace/scripting: silence PERL_EMBED_* backtick errors
> > perf trace/scripting: ignore shadowed variable warning for
> > perf-trace-perl.c
> > perf trace/scripting: fix Perl common_* access functions
> > perf trace/scripting: Add Fedora libperl install note to doc
> >
> > tools/perf/Makefile | 6 ++--
> > tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 30 ++++++++++----------
> > tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 6 ++--
> > tools/perf/scripts/perl/Perf-Trace-Util/README | 4 +-
> > tools/perf/util/trace-event-perl.c | 10 ++++--
> > tools/perf/util/trace-event-perl.h | 6 ++--
> > 6 files changed, 32 insertions(+), 30 deletions(-)
>
> Applied, thanks Tom!
>
> I tried a few simple things and it worked fine, so i put it into the
> permanent perf/scripting branch. I think this looks like a nice feature:
> a perfect fit to do rapid prototyping of tracing applets. (or just to
> use it for ad-hoc, programming based analysis of tracing data)
>
Great, thanks!
I agree that usability is key and could use some more work - I'll submit
some more patches addressing that soon...
Thanks,
Tom
> There's a few odd ends to 'perf trace' usability we need to fix before
> this can be merged into perf/core. For example if libperl isnt
> installed, 'perf trace' emits this warning:
>
> Perl scripting not supported. Install libperl and rebuild perf to
> enable it. e.g. apt-get install libperl-dev (ubuntu), yum install
> perl-ExtUtils-Embed (Fedora), etc.
>
> We should only emit that if -g or -s is used - it's a nuisance in the
> other cases. Most distributions dont have libperl installed by default.
>
> Also, a few simple examples and some heads-up about the power of
> scripting should be put into Documentation/perf-trace.txt as well.
> Something minimal - and it can include a Perl example as well. Some
> practical version of perl/Perf-Trace-Util/README or so. We want curious
> people who know Perl and try 'perf trace --help' to have some minimal
> entry vector into this space.
>
> A third question is - right now we install the sample Perl scripts on
> 'make install', but there's no mechanism to see the scripts that are
> available. 'perf trace -l/--list' might be useful?
>
> I.e. the whole pathway of random perf users coming in and starting to
> use the script engine 'spontaneusly' and 'intuitively' is not yet
> thought through - the capabilities are hidden too much.
>
> Thanks,
>
> Ingo