Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79896 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86029 invoked from network); 23 Dec 2014 21:59:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Dec 2014 21:59:06 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.44 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.218.44 mail-oi0-f44.google.com Received: from [209.85.218.44] ([209.85.218.44:59159] helo=mail-oi0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/63-01814-9A5E9945 for ; Tue, 23 Dec 2014 16:59:05 -0500 Received: by mail-oi0-f44.google.com with SMTP id e131so15401401oig.3 for ; Tue, 23 Dec 2014 13:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=WRN+51Xq7iTtuMyuwO+KDFIqkpZK7zaV1rNWTxspu+E=; b=bITU/z/CzKD0uz1sIk3bB43YMk7B99Ppp0sdfXnzQ2ok+M9hP1lgXoan4q8oR10F+a pt8orWfdq8hbgJ3y+tzSamgAVvlKMrrYYBSa0HFu4nav6m/HyVVzJdolT8fPKV2Bc0wY iScPhkigCwhGzbpT4wUC36tIrybWGJu2nW82BWs2nu5qv+yhrtj7tFzcfmbbpEIVf59i z6MlH8KjkLTA3Aul3WKs873pizt1W6yw443zZgXpCuVZVoFpprBvyx5jAVTbD5FS5djv Gw5PXCNc58yu/Z1gA/F3iwpSMqvhmHw/eWYs0BhAWFpF4lRqYPdRJK21udlZCNrrp83M 74aA== X-Received: by 10.202.216.138 with SMTP id p132mr16977381oig.47.1419371941865; Tue, 23 Dec 2014 13:59:01 -0800 (PST) Received: from [192.168.2.145] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id u15sm11121012obg.28.2014.12.23.13.59.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Dec 2014 13:59:01 -0800 (PST) Message-ID: <5499E5A4.2080106@gmail.com> Date: Tue, 23 Dec 2014 13:59:00 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Jacob Bednarz , internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Line profiler for PHP From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > The questions I have are: - Is this even possible? Yes, should be possible but: 1. If you want precision, it would slow down your code a lot, as basically you need to record timing of each opcode, which can be very expensive. 2. If you're ok with less precision, you can do sampling, but in that case you probably need your script to spend a lot of time in the same areas of the code to have any meaningful results, otherwise it'd be just random. > - Are there any projects out there or being worked on that achieve > this? Most of the profilers afaik go by functions. Most probably because line-level profiling would be so intrusive as to not produce really valid results, but maybe it can be done in a way that is not that intrusive. Stackoverflow question http://stackoverflow.com/q/1113034/214196 has the link to some profiling tool that seems to do line-level, but from the fact they mention PHP 4 support I'm not sure how up-to-date it is. > - If nothing exists, I am happy to look into this however I will need > some guidance on best practices, caveats with profiling PHP and ways > of parsing the file correctly. Not sure what you mean by "parsing the file correctly" - PHP engine does the parsing, profiler shouldn't do any parsing. -- Stas Malyshev smalyshev@gmail.com