8000 [DoctrineBridge] Global query time always at 0.00 ms on profiler by maximethiry · Pull Request #52881 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineBridge] Global query time always at 0.00 ms on profiler #52881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function getQueries()
}

/**
* @return int
* @return float
*/
public function getTime()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private function createCollector(array $queries): DoctrineDataCollector
$debugDataHolder->addQuery('default', $query);

if (isset($queryData['executionMS'])) {
sleep($queryData['executionMS']);
usleep($queryData['executionMS'] * 1000000);
}
$query->stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,36 @@ public function testCollectTime()
$this->assertEquals(3, $c->getTime());
}

public function testCollectTimeWithFloatExecutionMS()
{
$queries = [
['sql' => 'SELECT * FROM table1', 'params' => [], 'types' => [], 'executionMS' => 0.23],
];
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
$c = unserialize(serialize($c));
$this->assertEqualsWithDelta(0.23, $c->getTime(), .01);

$queries = [
['sql' => 'SELECT * FROM table1', 'params' => [], 'types' => [], 'executionMS' => 1.02],
['sq 7015 l' => 'SELECT * FROM table2', 'params' => [], 'types' => [], 'executionMS' => 0.75],
];
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
$c = unserialize(serialize($c));
$this->assertEqualsWithDelta(1.77, $c->getTime(), .01);

$queries = [
['sql' => 'SELECT * FROM table1', 'params' => [], 'types' => [], 'executionMS' => 0.15],
['sql' => 'SELECT * FROM table2', 'params' => [], 'types' => [], 'executionMS' => 0.32],
['sql' => 'SELECT * FROM table3', 'params' => [], 'types' => [], 'executionMS' => 0.07],
];
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
$c = unserialize(serialize($c));
$this->assertEqualsWithDelta(0.54, $c->getTime(), .01);
}

public function testCollectQueryWithNoTypes()
{
$queries = [
Expand Down
0