Skip to content
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

Use monotonic timer in rex_timer #5773

Closed
wants to merge 3 commits into from
Closed

Use monotonic timer in rex_timer #5773

wants to merge 3 commits into from

Conversation

staabm
Copy link
Member

@staabm staabm commented Aug 13, 2023

closes #5772

debug addon screen after change

grafik

@@ -129,4 +129,8 @@ public function getFormattedDelta($precision = self::MILLISEC, $decimals = 3)
$time = $this->getDelta($precision);
return rex_formatter::number($time, [$decimals]);
}

static private function now() {
return hrtime(true) / 1e9;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inspired by guzzle/guzzle#2242

@staabm
Copy link
Member Author

staabm commented Aug 13, 2023

@bloep why do we need the microtime() in addition to the rex_timer in

$timer = new rex_timer();
$epStart = microtime(true);
$res = parent::registerPoint($extensionPoint);
$epEnd = microtime(true);
$epDur = $timer->getDelta();

@bloep
Copy link
Member

bloep commented Aug 13, 2023

@bloep why do we need the microtime() in addition to the rex_timer in

$timer = new rex_timer();
$epStart = microtime(true);
$res = parent::registerPoint($extensionPoint);
$epEnd = microtime(true);
$epDur = $timer->getDelta();

if i have it right in my mind, it has to do with the fact that clockwork wants to have an absolute time from process begin, so that it appears correctly in the timeline.
rex_timer::getDelta() returns only the delta for the time period

@gharlan
Copy link
Member

gharlan commented Aug 14, 2023

Bei rex_timer kann man an den Constructor eine Start-microtime übergeben, was wir im Core hier auch tun.
Ich denke, dass sich das beißt mit der hrtime-Benutzung.
Weiß nicht, ob sich das sinnvoll lösen lässt?

@gharlan
Copy link
Member

gharlan commented Sep 1, 2023

Also ich sehe diese zwei Varianten:

  1. rex_timer hat intern ein Flag, ob er mit hrtime oder microtime arbeitet. Und wenn eine Startzeit übergeben wurde, dann arbeitet er weiter mit microtime.
  2. Oder wir lassen es doch so, wie es ist, da wir den rex_timer ja nicht für wirklich kritische Dinge nutzen, sondern eigentlich nur für Performance-Messungen

@staabm staabm closed this Sep 1, 2023
@staabm
Copy link
Member Author

staabm commented Sep 1, 2023

2

@staabm staabm deleted the hrtime branch September 1, 2023 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

hrtime statt microtime verwenden
3 participants