Contact
Site: US UK AU |

How to enable the Magento profiler

How to enable the Magento profiler

Overview
This article explains how to enable and interpret Magento’s profiler feature to assist with development.

Purpose

Developers can use the Magento Profiler to examine code and diagnose problems such as slow load times and processes.

Note the following words of caution:

  • Only developers with an intimate understanding of both PHP and Magento should attempt to use the profiler.

  • Do not use the profiler on live sites; the profiler exposes sensitive information and is therefore only safe to use on development sites.

Enabling the profiler

Use the following procedure to enable the profiler:

  1. From the Magento Admin Panel, select System > Configuration (Figure 1).


    Figure 1. Magento Admin Panel; System > Configuration.

  2. Scroll down to the Advanced sub-menu on the left and click Developer (Figure 2).


    Figure 2. Advanced > Developer.

  1. From the Debug drop-down list, in the Profiler field, click Yes (Figure 3).


    Figure 3. Debug > Profiler > Yes.

  2. Click Save Config (Figure 4).


    Figure 4. Save Config button.

  3. Open the index.php file in the root install.

  4. Find the line #Varien_Profiler::enable() and uncomment it. If this line does not exist, then place it anywhere before the line Mage::run($mageRunCode, $mageRunType.);

  5. Test the profiler by navigating to any forward-facing web page. If the profiler is functioning, it will resemble Figure 5. Refer to the next section to learn how to read these results.


    Figure 5. Sample Profiler output.

Reading the results

As shown in Figure 5, the resulting table presents the following information:

  • Memory usage: Indicated on the top right in bytes. Divide by 1048576 to convert this number to megabytes

  • Code profiler: This column identifies the block of code being executed

  • Time:This column shows how long the page to execute the code, in seconds

  • Cnt: Representing “count,” this column shows how many times this individual code block ran to generate the required output

  • Emalloc: The amount of memory PHP assigned to this operation, represented in bytes

  • RealMem: The actual amount of memory used to process the operation

     

    For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

     

Article Rating (2 Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How to conserve disk space in Magento
Added on Fri, Jan 17, 2014
How to perform Magento database maintenance
Added on Tue, Jul 30, 2013
How to enable system error logging in Magento 1.x
Added on Wed, Sep 19, 2018
How to remove index.php from your Magento site URL
Added on Wed, May 31, 2017
How to configure the Magento Product Importer (Magmi)
Added on Mon, Jan 26, 2015
How to configure CDN access for Magento
Added on Wed, May 16, 2018
How to change Magento base URLs
Added on Tue, Jun 12, 2018
How to configure multiple Magento storefronts
Added on Mon, Jul 29, 2013
How to flush your Magento cache
Added on Tue, Mar 1, 2016
How to issue a reindex in Magento
Added on Fri, Nov 15, 2013