All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Liming <liming.wang@windriver.com>
To: Tom Zanussi <tzanussi@gmail.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, fweisbec@gmail.com,
	rostedt@goodmis.org, acme@ghostprotocols.net
Subject: Re: [PATCH 2/2] perf trace/scripting: Don't display 'scripting unsupported' msg unnecessarily
Date: Mon, 07 Dec 2009 14:31:57 +0800	[thread overview]
Message-ID: <4B1CA15D.1000605@windriver.com> (raw)
In-Reply-To: <1260163919-6679-3-git-send-email-tzanussi@gmail.com>

Tom Zanussi wrote:
> The 'scripting unsupported' message should only be displayed when the
> -s or -g options are used, and not when they aren't, as the current
> code does.
> 
> Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
> ---
>  tools/perf/util/trace-event-perl.c |   64 +++++++++++++++++++++++++++++++-----
>  1 files changed, 55 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/perf/util/trace-event-perl.c b/tools/perf/util/trace-event-perl.c
> index 59564b2..a5ffe60 100644
> --- a/tools/perf/util/trace-event-perl.c
> +++ b/tools/perf/util/trace-event-perl.c
> @@ -570,26 +570,72 @@ struct scripting_ops perl_scripting_ops = {
>  	.generate_script = perl_generate_script,
>  };
>  
> -#ifdef NO_LIBPERL
> -void setup_perl_scripting(void)
> +static void print_unsupported_msg(void)
>  {
>  	fprintf(stderr, "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.\n");
> +		"  Install libperl and rebuild perf to enable it.\n"
> +		"For example:\n  # apt-get install libperl-dev (ubuntu)"
> +		"\n  # yum install perl-ExtUtils-Embed (Fedora)"
> +		"\n  etc.\n");
>  }

I have one question about how to compile c program that embedded perl function:

$cat foo.c
#include <EXTERN.h>
#include <perl.h>
int main(void)
{
         perl_alloc();
         return 0;
}

$gcc  -x c foo.c `perl -MExtUtils::Embed -e ccopts 2>/dev/null`  -o foo `perl 
-MExtUtils::Embed -e ldopts 2>/dev/null`
/usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a:1: error: expected identifier or 
'(' before '!' token
/usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a:2: error: stray '`' in program
...

About thousand of error.
I'm using ubuntu 8.04. Above error leads "tools/perl/Makefile" can't find the 
libperl-dev and define "NO_LIBPERL", but I have installed "libperl-dev".

Did you ever encounter this error?
Thanks.

Liming Wang
> -#else
> -void setup_perl_scripting(void)
> +
> +static int perl_start_script_unsupported(const char *script __unused)
> +{
> +	print_unsupported_msg();
> +
> +	return -1;
> +}
> +
> +static int perl_stop_script_unsupported(void)
> +{
> +	return 0;
> +}
> +
> +static void perl_process_event_unsupported(int cpu __unused,
> +					   void *data __unused,
> +					   int size __unused,
> +					   unsigned long long nsecs __unused,
> +					   char *comm __unused)
> +{
> +}
> +
> +static int perl_generate_script_unsupported(const char *outfile __unused)
> +{
> +	print_unsupported_msg();
> +
> +	return -1;
> +}
> +
> +struct scripting_ops perl_scripting_unsupported_ops = {
> +	.name = "Perl",
> +	.start_script = perl_start_script_unsupported,
> +	.stop_script = perl_stop_script_unsupported,
> +	.process_event = perl_process_event_unsupported,
> +	.generate_script = perl_generate_script_unsupported,
> +};
> +
> +static void register_perl_scripting(struct scripting_ops *scripting_ops)
>  {
>  	int err;
> -	err = script_spec_register("Perl", &perl_scripting_ops);
> +	err = script_spec_register("Perl", scripting_ops);
>  	if (err)
>  		die("error registering Perl script extension");
>  
> -	err = script_spec_register("pl", &perl_scripting_ops);
> +	err = script_spec_register("pl", scripting_ops);
>  	if (err)
>  		die("error registering pl script extension");
>  
>  	scripting_context = malloc(sizeof(struct scripting_context));
>  }
> +
> +#ifdef NO_LIBPERL
> +void setup_perl_scripting(void)
> +{
> +	register_perl_scripting(&perl_scripting_unsupported_ops);
> +}
> +#else
> +void setup_perl_scripting(void)
> +{
> +	register_perl_scripting(&perl_scripting_ops);
> +}
>  #endif


  reply	other threads:[~2009-12-07  6:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07  5:31 [PATCH 0/2] perf trace/scripting: A couple bugfixes Tom Zanussi
2009-12-07  5:31 ` [PATCH 1/2] perf trace/scripting: Fix compile err when libperl not installed Tom Zanussi
2009-12-07  5:31 ` [PATCH 2/2] perf trace/scripting: Don't display 'scripting unsupported' msg unnecessarily Tom Zanussi
2009-12-07  6:31   ` Wang Liming [this message]
2009-12-07  7:13     ` Tom Zanussi
2009-12-07  7:23       ` Wang Liming
2009-12-07  7:10   ` [tip:perf/urgent] " tip-bot for Tom Zanussi
2009-12-07  7:05 ` [PATCH 0/2] perf trace/scripting: A couple bugfixes Ingo Molnar
2009-12-07  7:14   ` Tom Zanussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B1CA15D.1000605@windriver.com \
    --to=liming.wang@windriver.com \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tzanussi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.