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

[BUG]: getTotalElapsedSeconds() - too many seconds #15822

Closed
zak-wojtek77 opened this issue Dec 7, 2021 · 10 comments
Closed

[BUG]: getTotalElapsedSeconds() - too many seconds #15822

zak-wojtek77 opened this issue Dec 7, 2021 · 10 comments
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium

Comments

@zak-wojtek77
Copy link

Describe the bug
Function "getTotalElapsedSeconds()" return too many seconds.
https://docs.phalcon.io/4.0/pl-pl/db-models-events#profiling-sql-statements

To Reproduce

// do any query to database
$result = $container->get('db')->query('select 1');
$result->fetch();
// get profiles
$profiles = $container->get('profiler')->getProfiles();
foreach ($profiles as $profile) {
    var_dump($profile->getTotalElapsedSeconds());
}

Expected behavior
It should be less than 1 second, show 221907 seconds.

Details

  • Phalcon version: 4.1.2
  • PHP Version: 7.4
  • Operating System: Debian SID
  • Installation type: Compiling from source
  • Zephir version (if any):
  • Server: Nginx
  • Other related info (Database, table schema): MariaDB

Additional context
This problem does not exist in Phalcon 4.0.6

@zak-wojtek77 zak-wojtek77 added bug A bug report status: unverified Unverified labels Dec 7, 2021
@Jeckerson
Copy link
Member

/cc @niden I think this was already fixed.

@niden
Copy link
Sponsor Member

niden commented Dec 17, 2021

I believe we fixed this already with #15249

If possible can you install v5 and check if all is OK?

@zak-wojtek77
Copy link
Author

I cannot install Phalcon-5.0.0alpha7. I have any error during compilation. Second in my company I would like install only more stable Phalcon like 4.1.2. The best option for me would be if you release new version of Phalcon 4 with this bug. Thank you.

@satorumoriwaki
Copy link

This needs to be fixed for 4.1.x because the microtime() and the hrtime() return different values.

$startMicro = microtime(true);
$startNano = hrtime(true);

// wait for 5 seconds
sleep(5);

echo 'microtime: ' . (microtime(true) - $startMicro);
echo 'hrtime: ' . (hrtime(true) - $startNano);
microtime: 5.0255100727081
hrtime: 5031415000

Phalcon 4.0.x uses microtime() only.
https://github.com/phalcon/cphalcon/blob/4.0.x/phalcon/Db/Profiler.zep#L150

Phalcon 4.1.x uses both microtime() and hrtime().
https://github.com/phalcon/cphalcon/blob/4.1.x/phalcon/Db/Profiler.zep#L155-L159

Phalcon 5 uses hrtime() only.
https://github.com/phalcon/cphalcon/blob/master/phalcon/Db/Profiler.zep#L150

@Jeckerson Jeckerson added wontfix The issue will not be fixed or implemented and removed bug A bug report status: unverified Unverified labels Oct 26, 2022
@Jeckerson
Copy link
Member

This won't be fixed in v4, please upgrade to v5. Closing.

@zak-wojtek77
Copy link
Author

I have installed Phalcon 5.1.1 and this problem still exists.

@niden niden reopened this Nov 30, 2022
@niden niden added bug A bug report 5.0 The issues we want to solve in the 5.0 release status: unverified Unverified status: medium Medium and removed wontfix The issue will not be fixed or implemented status: unverified Unverified labels Nov 30, 2022
@niden
Copy link
Sponsor Member

niden commented Nov 30, 2022

@zak-wojtek77 Thank you for this. For some reason the commits from #15249 never made it to the 5.0.x branch :/

Issuing a PR shortly to get this sorted out.

@zak-wojtek77
Copy link
Author

Thank you for info.

@niden
Copy link
Sponsor Member

niden commented Nov 30, 2022

Resolved in #16234

@niden niden closed this as completed Nov 30, 2022
@zak-wojtek77
Copy link
Author

I have installed Phalcon 5.1.2 and now is OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium
Projects
Archived in project
Development

No branches or pull requests

4 participants