Giter Club home page Giter Club logo

aoe_profiler's Introduction

Magento Profiler

http://www.fabrizio-branca.de/magento-profiler.html

Usage

Enable profiler in System > Configuration > Developer > Debug > Profiler.

  • Trigger profiling by appending ?profile=1 to the url.
  • If you're using PHPStorm and have the RemoteCall plugin installed append ?profile=1&links=1 to the url to enable profiling including links to PHPStorm (this might be a slower).

Profile cli scripts

To profile shell scripts like Mage_Shell_Compiler change code at the end of the file to:

$_GET['profile'] = true;
require_once   '../app/Mage.php';
Varien_Profiler::start("wrapper");
$shell = new Mage_Shell_Compiler();
$shell->run();
Varien_Profiler::stop("wrapper");
Mage::helper('aoe_profiler')->renderProfilerOutputToFile();

You will find html page with rendered profiler output in var/profile/{date}.html

Profile only slow requests in production

To profile slow requests in production you will need to modify index.php. Warning: This will have an impact on overall performance as the timers will be recorded for every request but only rendered for slow requests.

On the 2nd line, add:

$_slowRequestTime = 10.0;  // Set to FALSE to disable
if ($_slowRequestTime) $_start = microtime(TRUE);

Before Mage::run...) add:

if ($_slowRequestTime) Varien_Profiler::enable();

After Mage::run(...) add:

if ($_slowRequestTime) {
    $_elapsed = microtime(true) - $_start;
    if ($_elapsed > $_slowRequestTime) {
        $_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : 'unknown';
        $_profileName = Mage::helper('aoe_profiler')->renderProfilerOutputToFile($_uri);
        // Log, email, etc..
        Mage::log("Request for $_uri took $_elapsed seconds. See profiler output in $_profileName", Zend_Log::INFO, 'slow_requests.log');
    }
}

Enable database profiling

Add this to your local.xml:

<config>
    <global>
        <resources>
            <default_setup>
                <connection>
                    <profiler>1</profiler>
                </connection>
            </default_setup>
        </resources>
    </global>
</config>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.