Results 1 to 3 of 3

Thread: How can I tell where my PHP pages are spending the most time in functions?

  1. #1
    Join Date
    Jul 2006
    Location
    Calgary, Alberta
    Beans
    1,108
    Distro
    Ubuntu 13.04 Raring Ringtail

    How can I tell where my PHP pages are spending the most time in functions?

    I wrote a PHP application and it's completely function based with separate classes. It takes quite a while to load some of the heavier pages so I was wondering if there's any way to see a graph of which functions is taking up most of the time. Both in the PHP and the Javascript.
    Quote Originally Posted by Tristam Green View Post
    I can tell you something about a turntable.
    I have two of them.
    And a microphone.
    Where it's at.

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,819
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: How can I tell where my PHP pages are spending the most time in functions?

    Not that I know of, though you could sprinkle in a few commands to echo a timestamp at various points along the way.

    Does this application extract information from a database? In my experience PHP scripts themselves are never slow, but queries against a poorly-indexed SQL database can bog things down a lot. Make sure any SELECTs use keys that have corresponding indexes in the DB; if you are selecting on multiple fields, you need an index that incorporates all those fields. Use the SQL "analyze" command as well.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    8,069
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: How can I tell where my PHP pages are spending the most time in functions?

    There are several linux performance tools. strace is one of them. I don't know of any for PHP specifically, but there are some webpage metrics. I know that sugarcrm is based on PHP and had built-in query timing so you could see which query pages were taking a long time. I would look at the source code/PHP to see how those metrics are generated and apply to your code.

    Search here: http://forums.sugarcrm.com/

    Overview of PHP performance tweaks: http://support.sugarcrm.com/04_Find_...ormance_Tweaks
    Last edited by tgalati4; September 11th, 2013 at 04:29 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •