Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175407
b: refs/heads/master
c: 67a6259
h: refs/heads/master
i:
  175405: ec0ee01
  175403: af99810
  175399: 9e30c34
  175391: 82648f9
v: v3
  • Loading branch information
Tom Zanussi authored and Ingo Molnar committed Dec 7, 2009
1 parent bb6b914 commit 42de319
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 11a80ddbf3521c428bcde2d31e6632cef186bae9
refs/heads/master: 67a6259ec97b8408f86f2fe8459d2233f0b0987d
64 changes: 55 additions & 9 deletions trunk/tools/perf/util/trace-event-perl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 42de319

Please sign in to comment.