Hi all,
I have a perl interp embedded in a Mac app. I can successfully run the
debugger by passing "-d" in the argv to perl_parse() (and also setting
PERLDB_OPTS to NonStop and running perl_run() at some point to kick
off the debugging).
I'm now trying to use NYTProf inside the embedded app for cases where
it's not possible to reduce to a test case (eg. some tricky stuff
using Cocoa bindings bound to bridged perl objects).
Using the same sort of approach as NYTProf::Apache I successfully get
the nytprof.out file written out, but it always has zero statements.
What I'm doing to set up the interpreter is this:
#if EFCPerlInterpDebugger
char * embedding[] = { "", "-w", "-d", "-e", "0" };
#else
char * embedding[] = { "", "-w", "-e", "0" };
#endif
int embedding_count = sizeof(embedding) / sizeof(char *);
my_perl = perl_alloc();
PL_perl_destruct_level = 1;
perl_construct(my_perl);
perl_parse(my_perl, xs_init, embedding_count, embedding,
my_perl_env);
#if EFCPerlInterpDebugger || EFCPerlInterpNYTProf
perl_run(my_perl);
#endif
#if EFCPerlInterpNYTProf
eval_pv("$ENV{NYTPROF} = \"file=/tmp/nytprof.$$.out\";
require Devel::NYTProf::Core; DB::set_option(\"endatexit\", 1);
DB::set_option(\"addpid\", 1); require Devel::NYTProf;
DB::enable_profile();",TRUE);
#endif
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
Then at the end I'm doing this:
eval_pv("DB::finish_profile();", TRUE);
PL_perl_destruct_level = 1;
perl_destruct(my_perl);
perl_free(my_perl);
I tried setting endatexit to zero in case the lack of statements in
the -e statement was impeding it. I also tried removing the
enable_profile() and instead moving it to the places where perl code
was being executed, folliwing with disable_profile(). All to no avail.
It's worth noting in the actual code I never use eval_pv(), instead
making an SV * of an object and using call_method() directly.
Any ideas?
Thanks,
Mark.
--
Mark Aufflick
http://mark.aufflick.com/about/contact
http://pumptheory.com/about
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]