Commit 67a6259e authored by Tom Zanussi's avatar Tom Zanussi Committed by Ingo Molnar

perf trace/scripting: Don't display 'scripting unsupported' msg unnecessarily

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: default avatarTom Zanussi <tzanussi@gmail.com>
Cc: rostedt@goodmis.org
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1260163919-6679-3-git-send-email-tzanussi@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 11a80ddb
......@@ -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");
}
#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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment