tracer-complete needs start time

This commit is contained in:
Shish 2019-07-06 23:01:22 +01:00
parent 8ea78eed6a
commit b285acf70a
2 changed files with 6 additions and 6 deletions

8
composer.lock generated
View File

@ -302,12 +302,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/shish/eventtracer-php.git", "url": "https://github.com/shish/eventtracer-php.git",
"reference": "8fc0001dffa6cc68ee56e8681a2e27579eb70dca" "reference": "af72034e0003d507e1d64f357612312279f02bb4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/shish/eventtracer-php/zipball/8fc0001dffa6cc68ee56e8681a2e27579eb70dca", "url": "https://api.github.com/repos/shish/eventtracer-php/zipball/af72034e0003d507e1d64f357612312279f02bb4",
"reference": "8fc0001dffa6cc68ee56e8681a2e27579eb70dca", "reference": "af72034e0003d507e1d64f357612312279f02bb4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -338,7 +338,7 @@
], ],
"description": "An API to write JSON traces as used by the Chrome Trace Viewer", "description": "An API to write JSON traces as used by the Chrome Trace Viewer",
"homepage": "https://github.com/shish/eventtracer-php", "homepage": "https://github.com/shish/eventtracer-php",
"time": "2019-07-05T14:44:25+00:00" "time": "2019-07-06T21:56:55+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [

View File

@ -192,7 +192,7 @@ class Database
{ {
global $_tracer; global $_tracer;
$dur = microtime(true) - $start; $dur = microtime(true) - $start;
$_tracer->complete($dur, "DB Query", null, ["query"=>$query, "args"=>$args]); $_tracer->complete($start * 1000000, $dur * 1000000, "DB Query", null, ["query"=>$query, "args"=>$args]);
if ((DEBUG_SQL === true) || (is_null(DEBUG_SQL) && @$_GET['DEBUG_SQL'])) { if ((DEBUG_SQL === true) || (is_null(DEBUG_SQL) && @$_GET['DEBUG_SQL'])) {
$query = trim(preg_replace('/\s+/msi', ' ', $query)); $query = trim(preg_replace('/\s+/msi', ' ', $query));
@ -206,7 +206,7 @@ class Database
} }
$this->query_count++; $this->query_count++;
$this->dbtime += microtime(true) - $start; $this->dbtime += $dur;
} }
public function execute(string $query, array $args=[]): PDOStatement public function execute(string $query, array $args=[]): PDOStatement