-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProfiler.php
More file actions
32 lines (29 loc) · 1000 Bytes
/
Profiler.php
File metadata and controls
32 lines (29 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
*
* злой профайлер
* написано на коленке
* @author nur
*
*/
class Evil_Profiler extends Zend_Db_Profiler
{
protected $_message = null;
protected $_logger = null;
protected $_stream = '/tmp/evil.profiler';
public function setEnabled($enable)
{
$this->_message = new Zend_Log_Writer_Stream($this->_stream);
$this->_logger = new Zend_Log($this->_message);
parent::setEnabled($enable);
}
public function queryEnd($queryId)
{
$state = parent::queryEnd($queryId);
$profile = $this->getQueryProfile($queryId);
$this->_totalElapsedTime += $profile->getElapsedSecs();
$this->_logger->info (implode(' ',array((string)round($profile->getElapsedSecs(),5),
$profile->getQuery(),
($params=$profile->getQueryParams())?implode(' ',$params):null)));
}
}