How to enable profiling on Prestashop

Published : 02/26/2015 13:26:45
Categories : Optimize Prestashop

Note: profiling displays stats on your store so you better do it in a shortly in a slack period

Enabling profiling

Edit file /config/ of Prestashop.

/* Debug only */
if (!defined('_PS_MODE_DEV_'))
define('_PS_MODE_DEV_', true);
/* Compatibility warning */
if (_PS_MODE_DEV_ === true)
	@ini_set('display_errors', 'on');
	@error_reporting(E_ALL | E_STRICT);
	define('_PS_DEBUG_SQL_', true);
	@ini_set('display_errors', 'off');
	define('_PS_DEBUG_SQL_', false);

define('_PS_DEBUG_PROFILING_', false);
define('_PS_MODE_DEMO_', false);

To enable profiling just set true on _PS_DEBUG_PROFILING_:

define('_PS_DEBUG_PROFILING_', true);

Then display a page of your shop that is slow and you will see statistics at the bottom of the page.

Result analysis

Here is an exemple of these stats:

Résultats du profiling Prestashop

As you can see the shop is not very fast: 8 seconds to generate the page.

If you don't know much, I advise you to post a message on Prestashop forum with a screenshot of these stats; tell us your Prestashop version and your hosting type (dedicated, shared, etc.). Then you should have answers from the community.

Otherwise, here is a short description:

Left column

  • config: loading time of Prestashop classes
  • init: initialisation of the controler
  • initContent
  • initFooter
  • display: HTML generation (template smarty)

Column "Hook processing"

Hooks are sorted from slower to faster so that it is easy to identify bottle necks. If one of the hook is very slow, check which modules are hooked on it, then unhook them one after an other to know which one is slow.

Right column

Most important here is the queries count and time spent into them.

You must be register

Clic here to register

Add a comment