public function convertTimers(Sheep_Debug_Model_RequestInfo $request)
    {
        if (!$request->getTimers()) {
            return array();
        }

        $requestData = array();
        $requestData['id'] = $request->getToken();
        $requestData['left'] = 0;
        $requestData['events'] = array();

        $currentTime = 0;
        /**  timer is an array defined by @see Varien_Profiler */
        foreach ($request->getTimers() as $name => $timer) {

            if (!$timer['sum']) {
                continue;
            }

            // convert seconds into microseconds
            $timer['sum'] *= 1000;

            $category = $this->getCategory($name);

            // we don't have start time, end time or multiple periods
            // so built an estimation of how this event might look assuming that we have only one
            // occurrence (period) and that it followed immediately after last event
            $requestData['events'][] = array(
                'name'      => $name,
                'category'  => $category,
                'origin'    => 0,
                'starttime' => $currentTime,
                'endtime'   => $currentTime + $timer['sum'],
                'duration'  => $timer['sum'],
                'memory'    => round($timer['realmem'] / pow(2014, 2), 2),
                'periods'   => array(
                    array('start' => $currentTime, 'end' => $currentTime + $timer['sum'])
                )
            );

            // we assume certain events contain the other events (most of the time it makes sense)
            if ($category != self::SECTION) {
                $currentTime += $timer['sum'];
            }
        }

        $data = array();
        $data['max'] = $currentTime;
        $data['requests'] = array($requestData);

        return $data;
    }
public function convertTimers(Sheep_Debug_Model_RequestInfo $request)
    {
        if (!$request->getTimers()) {
            return array();
        }

        $requestData = array();
        $requestData['id'] = $request->getToken();
        $requestData['left'] = 0;
        $requestData['events'] = array();

        $currentTime = 0;
        
        foreach ($request->getTimers() as $name => $timer) {

            if (!$timer['sum']) {
                continue;
            }

            
            $timer['sum'] *= 1000;

            $category = $this->getCategory($name);

            
            
            
            $requestData['events'][] = array(
                'name'      => $name,
                'category'  => $category,
                'origin'    => 0,
                'starttime' => $currentTime,
                'endtime'   => $currentTime + $timer['sum'],
                'duration'  => $timer['sum'],
                'memory'    => round($timer['realmem'] / pow(2014, 2), 2),
                'periods'   => array(
                    array('start' => $currentTime, 'end' => $currentTime + $timer['sum'])
                )
            );

            
            if ($category != self::SECTION) {
                $currentTime += $timer['sum'];
            }
        }

        $data = array();
        $data['max'] = $currentTime;
        $data['requests'] = array($requestData);

        return $data;
    }
public function convertTimers ( Sheep_Debug_Model_RequestInfo $ request ) { if ( ! $ request -> getTimers ( ) ) { return array ( ) ; } $ requestData = array ( ) ; $ requestData [ 'id' ] = $ request -> getToken ( ) ; $ requestData [ 'left' ] = 0 ; $ requestData [ 'events' ] = array ( ) ; $ currentTime = 0 ; /**  timer is an array defined by @see Varien_Profiler */ foreach ( $ request -> getTimers ( ) as $ name => $ timer ) { if ( ! $ timer [ 'sum' ] ) { continue ; } // convert seconds into microseconds $ timer [ 'sum' ] *= 1000 ; $ category = $ this -> getCategory ( $ name ) ; // we don't have start time, end time or multiple periods // so built an estimation of how this event might look assuming that we have only one // occurrence (period) and that it followed immediately after last event $ requestData [ 'events' ] [ ] = array ( 'name' => $ name , 'category' => $ category , 'origin' => 0 , 'starttime' => $ currentTime , 'endtime' => $ currentTime + $ timer [ 'sum' ] , 'duration' => $ timer [ 'sum' ] , 'memory' => round ( $ timer [ 'realmem' ] / pow ( 2014 , 2 ) , 2 ) , 'periods' => array ( array ( 'start' => $ currentTime , 'end' => $ currentTime + $ timer [ 'sum' ] ) ) ) ; // we assume certain events contain the other events (most of the time it makes sense) if ( $ category != self :: SECTION ) { $ currentTime += $ timer [ 'sum' ] ; } } $ data = array ( ) ; $ data [ 'max' ] = $ currentTime ; $ data [ 'requests' ] = array ( $ requestData ) ; return $ data ; }
Converts timers registered by Varien Profile into structure understood by Symfony

@param Sheep_Debug_Model_RequestInfo $request
@return array
Converts timers registered by Varien Profile into structure understood by Symfony