Message from discussion
Trouble getting NYTProf to work in an embedded perl interp
Received: by 10.224.189.75 with SMTP id dd11mr7617107qab.6.1347377297257;
Tue, 11 Sep 2012 08:28:17 -0700 (PDT)
X-BeenThere: develnytprof-dev@googlegroups.com
Received: by 10.224.101.68 with SMTP id b4ls1180954qao.0.gmail; Tue, 11 Sep
2012 08:28:16 -0700 (PDT)
Received: by 10.59.7.167 with SMTP id dd7mr6651156ved.26.1347377296464;
Tue, 11 Sep 2012 08:28:16 -0700 (PDT)
Received: by 10.59.7.167 with SMTP id dd7mr6651155ved.26.1347377296454;
Tue, 11 Sep 2012 08:28:16 -0700 (PDT)
Return-Path: <Tim.Bu...@pobox.com>
Received: from smtp.pobox.com (b-pb-sasl-quonix.pobox.com. [208.72.237.35])
by gmr-mx.google.com with ESMTP id z16si2606116vdf.0.2012.09.11.08.28.16;
Tue, 11 Sep 2012 08:28:16 -0700 (PDT)
Received-SPF: pass (google.com: domain of Tim.Bu...@pobox.com designates 208.72.237.35 as permitted sender) client-ip=208.72.237.35;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of Tim.Bu...@pobox.com designates 208.72.237.35 as permitted sender) smtp.mail=Tim.Bu...@pobox.com; dkim=pass header...@pobox.com
Received: from smtp.pobox.com (unknown [127.0.0.1])
by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 0ADC77EEF
for <develnytprof-dev@googlegroups.com>; Tue, 11 Sep 2012 11:28:16 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to
:subject:message-id:references:mime-version:content-type
:in-reply-to; s=sasl; bh=UOrlQJJgSP2Wmfbie2MyB1J8Kfw=; b=lCvjyYX
ondgvN5/lthm79lZgE6t0kgY5fXpeyWTSjH/tL2bxnY/dlINjBSRJM0Q9TarmPMU
iqQtrLZMM+OzEgE4xm5Hz2soiGHQL8RixSmLi/w/WWOjixgRzzgk79DMrnzx9V93
P9Qxti8/Y7FRJfG3m1vuY1AaDtNv3tEWxn9w=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=date:from:to
:subject:message-id:references:mime-version:content-type
:in-reply-to; q=dns; s=sasl; b=D5yNptmD6kPEl71Lj9HoKUZ74KZXCDqij
F58jeEgz2u4CoxLgCQM8MMmkSyHFm9v9oDY4lETqUCL86J27Bj7dZHU1CIoEDC/g
RDzCySBwP2JQSV0uNBSarZsjOmtMHmzGz5P9rFk1Bb1jzv3dy3JoriBgNmv5uYDF
Trc6MuEAmU=
Received: from b-pb-sasl-quonix.pobox.com (unknown [127.0.0.1])
by b-sasl-quonix.pobox.com (Postfix) with ESMTP id ED68F7EEE
for <develnytprof-dev@googlegroups.com>; Tue, 11 Sep 2012 11:28:15 -0400 (EDT)
Received: from timac.local (unknown [86.47.232.121]) (using TLSv1 with cipher
DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by
b-sasl-quonix.pobox.com (Postfix) with ESMTPSA id BFFAD7EEC for
<develnytprof-dev@googlegroups.com>; Tue, 11 Sep 2012 11:28:11 -0400 (EDT)
Date: Tue, 11 Sep 2012 16:28:09 +0100
From: Tim Bunce <Tim.Bu...@pobox.com>
To: develnytprof-dev@googlegroups.com
Subject: Re: [develnytprof-dev: 2230] Trouble getting NYTProf to work in an
embedded perl interp
Message-ID: <20120911152809.GB27...@timac.local>
References: <CAJcZ_O9NkrT66U0HuicLgsgrq=7M=eL2E-xocfUHBYJgKfY...@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAJcZ_O9NkrT66U0HuicLgsgrq=7M=eL2E-xocfUHBYJgKfY...@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Pobox-Relay-ID: 4C25EB5C-FC25-11E1-93D4-BAB72E706CDE-13888548!b-pb-sasl-quonix.pobox.com
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.