-
Notifications
You must be signed in to change notification settings - Fork 571
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
Benchmark module doesn't use documented format for times #15388
Comments
From perl-diddler@tlinx.orgI looked at the Benchmark modules and it seems the bugs for it are in the perl5 category -- I guess that means it's part of 'Core'? Anyway, that's why I'm reporting this here. This is using the Inst_Version 1.13 distributed with 5.16.3 -- I.E. this may already be fixed, not easily testable at this point. But using a call to Benchmark::timestr: my $time_str = Benchmark::timestr($diff, 'all', '20.9F'); I got: note, at the top, I have: So, it should be giving microsecond accuracy. Drilling down /* A time value that is accurate to the nearest So the cpu seconds only appear to be accurage to 100's of a second, but clock_info on my system shows:
(My cpu clock is set to 1000Hz:
so that would make it logical that cpu times might only be accurate to 1ms, but it doesn't appear to have used the 20.9F format for the realtime either. I was a bit surprised by the output -- I expected a space-separated string of 5 numbers (for real, parent process and children processes). I must have not been clear on the documentation about the extra verbiage being included. Side question: Is there anyway just to get back the array of 5 numbers so no conversions are necessary -- especially since the conversion thing doesn't seem to work right? (thought 20.9F would give me double precision (64-bits?)... thought I'd at least get back more than centisecs... Note clock_info does *seem* to return time in nanoseconds...but haven't investigated those sources (not that I need such accuracy, but was trying, simply, to store the full accuracy of what Benchmark had stored internally -- thus my sideQ about a way to get values w/o conversions or breaking into the Benchmark object). At the very least, if that accuracy is the best that is possible, that might be mentioned in the manpage, though it's pretty clearly not using the precision for the real-time clock. |
From zefram@fysh.orgLinda Walsh wrote:
The module is distributed only with the Perl core; this is indeed the
As the name suggests, and as the documentation explicitly says, As you note, higher-resolution CPU timers are available on some hosts The documentation is not clear that the format string passed to -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From perl-diddler@tlinx.orgOn Wed Jun 08 16:16:16 2016, zefram@fysh.org wrote:
It's doubly unclear that the "FORMAT" only applies to the cpu times -- for which anything greater than 5.2f appears useless. I.e. the 1 place where > %5.2f could be seen, (wall clock) is is apparent that the FORMAT is ignored, vs. being used on the cpu-times where the :hireswallclock makes no difference. (i.e. - Irony?). |
From zefram@fysh.orgAs already discussed, there is no bug here. This ticket should be closed. -zefram |
@iabyn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#128349 (status was 'rejected')
Searchable as RT128349$
The text was updated successfully, but these errors were encountered: