diff options
| author | Tom Zanussi <tzanussi@gmail.com> | 2009-12-07 00:31:59 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-12-07 02:05:07 -0500 |
| commit | 67a6259ec97b8408f86f2fe8459d2233f0b0987d (patch) | |
| tree | f4c59f41befe7bec255db14ac568bc7b170d7258 /tools | |
| parent | 11a80ddbf3521c428bcde2d31e6632cef186bae9 (diff) | |
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: Tom 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: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
| -rw-r--r-- | 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 59564b22d9ce..a5ffe60db5d6 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 = { | |||
| 570 | .generate_script = perl_generate_script, | 570 | .generate_script = perl_generate_script, |
| 571 | }; | 571 | }; |
| 572 | 572 | ||
| 573 | #ifdef NO_LIBPERL | 573 | static void print_unsupported_msg(void) |
| 574 | void setup_perl_scripting(void) | ||
| 575 | { | 574 | { |
| 576 | fprintf(stderr, "Perl scripting not supported." | 575 | fprintf(stderr, "Perl scripting not supported." |
| 577 | " Install libperl and rebuild perf to enable it. e.g. " | 576 | " Install libperl and rebuild perf to enable it.\n" |
| 578 | "apt-get install libperl-dev (ubuntu), yum install " | 577 | "For example:\n # apt-get install libperl-dev (ubuntu)" |
| 579 | "perl-ExtUtils-Embed (Fedora), etc.\n"); | 578 | "\n # yum install perl-ExtUtils-Embed (Fedora)" |
| 579 | "\n etc.\n"); | ||
| 580 | } | 580 | } |
| 581 | #else | 581 | |
| 582 | void setup_perl_scripting(void) | 582 | static int perl_start_script_unsupported(const char *script __unused) |
| 583 | { | ||
| 584 | print_unsupported_msg(); | ||
| 585 | |||
| 586 | return -1; | ||
| 587 | } | ||
| 588 | |||
| 589 | static int perl_stop_script_unsupported(void) | ||
| 590 | { | ||
| 591 | return 0; | ||
| 592 | } | ||
| 593 | |||
| 594 | static void perl_process_event_unsupported(int cpu __unused, | ||
| 595 | void *data __unused, | ||
| 596 | int size __unused, | ||
| 597 | unsigned long long nsecs __unused, | ||
| 598 | char *comm __unused) | ||
| 599 | { | ||
| 600 | } | ||
| 601 | |||
| 602 | static int perl_generate_script_unsupported(const char *outfile __unused) | ||
| 603 | { | ||
| 604 | print_unsupported_msg(); | ||
| 605 | |||
| 606 | return -1; | ||
| 607 | } | ||
| 608 | |||
| 609 | struct scripting_ops perl_scripting_unsupported_ops = { | ||
| 610 | .name = "Perl", | ||
| 611 | .start_script = perl_start_script_unsupported, | ||
| 612 | .stop_script = perl_stop_script_unsupported, | ||
| 613 | .process_event = perl_process_event_unsupported, | ||
| 614 | .generate_script = perl_generate_script_unsupported, | ||
| 615 | }; | ||
| 616 | |||
| 617 | static void register_perl_scripting(struct scripting_ops *scripting_ops) | ||
| 583 | { | 618 | { |
| 584 | int err; | 619 | int err; |
| 585 | err = script_spec_register("Perl", &perl_scripting_ops); | 620 | err = script_spec_register("Perl", scripting_ops); |
| 586 | if (err) | 621 | if (err) |
| 587 | die("error registering Perl script extension"); | 622 | die("error registering Perl script extension"); |
| 588 | 623 | ||
| 589 | err = script_spec_register("pl", &perl_scripting_ops); | 624 | err = script_spec_register("pl", scripting_ops); |
| 590 | if (err) | 625 | if (err) |
| 591 | die("error registering pl script extension"); | 626 | die("error registering pl script extension"); |
| 592 | 627 | ||
| 593 | scripting_context = malloc(sizeof(struct scripting_context)); | 628 | scripting_context = malloc(sizeof(struct scripting_context)); |
| 594 | } | 629 | } |
| 630 | |||
| 631 | #ifdef NO_LIBPERL | ||
| 632 | void setup_perl_scripting(void) | ||
| 633 | { | ||
| 634 | register_perl_scripting(&perl_scripting_unsupported_ops); | ||
| 635 | } | ||
| 636 | #else | ||
| 637 | void setup_perl_scripting(void) | ||
| 638 | { | ||
| 639 | register_perl_scripting(&perl_scripting_ops); | ||
| 640 | } | ||
| 595 | #endif | 641 | #endif |
