On Tue, Sep 11, 2012 at 09:11:46PM +1000, Mark Aufflick wrote:
> 
> 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

Devel::NYTProf::Core has to be loaded as soon as possible. Certainly
before perl_run, and ideally very early in perl_parse. Try using:

    char * embedding[] = { "", "-w", "-d:NYTProf", "-e", "0" };

Tim.

-- 
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]

Reply via email to