Skip to content

Performance inside Loop #17

Open
Open
@Soetens

Description

@Soetens

Is it possible to have the performance inside a loop?

A very basic example:

\Performance\Performance::point('Test Root');   
sleep(3);  
for ($i = 1; $i <= 10; $i++) {  
    $sleepTime = rand(1,4);   
    \Performance\Performance::point('Sub ' . $i . ' (' . $sleepTime . ')');   
    sleep($sleepTime);   
    \Performance\Performance::finish();   
}   
\Performance\Performance::finish();   
\Performance\Performance::results();

Test Root should contain all the sleep() seconds combined, because that is what it take to run the whole for loop. But it just gives 3s, so the next Point stops the previous one.

Shouldn't it be possible to take the real performance time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions