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
I added more decimal digits to the timing statistics counters #1106
Conversation
…er to provide more detailed performance statistics
@maurorappa, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bagder, @gevaerts and @yangtse to be potential reviewers. |
thanks! |
Could this conceivably break some scripts if they expect data in a 0.000 and is microsecond really necessary for those statistics? All I get is a lot of x.xxx000 |
This is my output on Ubuntu Trusty: maurorappa@trusty:~/curl/src$ ./curl -sLk -w "%{http_code}\n%{time_total}: %{time_namelookup} %{time_connect} %{time_appconnect}\n%{speed_download} %{num_redirects}\n" https://dcs.ida.digital.cabinet-office.gov.uk -o /dev/null I can do statistical analysis of the SSL performance with more granularity. |
Ok. time_total is documented as millisecond resolution so that's something we have to consider. And I suspect it becomes somewhat more arbitrary after that since it's basically wall clock time. What if there was a variable like %{flags:microseconds,foo,bar} |
Ah yes good catch, |
I can fix the man page if it helps. |
Yes please, the millisecond mention is wrong now since commit ebeffe8 |
- Add %{flags:<flag>,...} to --write-out - New write-out flag stderr to redirect to stderr - New write-out flag moreprec to increase precision from 3 to 6 --- This is an alternative proposal to adding more precision by default. curl#1106
I think we should not do this by default, and that adding it as an option would be better. To that end I've written a counterproposal, you can see it at https://github.com/curl/curl/compare/master...jay:add_flags_to_write-out?expand=1 curld -sS --write-out " %{time_total} %{flags: moreprec,stderr} %{time_total}" example.com -o NUL 2>NUL
0.047
curld -sS --write-out " %{time_total} %{flags: moreprec,stderr} %{time_total}" example.com -o NUL 1>NUL
0.047000 |
Because of the risk that it will break some scripts? Because some machines won't have better accuracy than milliseconds anyway? What about inventing some additional syntax hint that allows users to specify precision per variable. like |
For all those reasons, but also with respect to the reporter measurements based off of differences in wall clock time are only so accurate. Your way is interesting, however I like the idea of %{flags regardless because it's extensible |
- Add %{flags:<flag>,...} to --write-out - New write-out flag 'fd[1-9]|stderr|stdout' to write to a specific fd - New write-out flag 'prec[0-99]' to increase precision of floats --- This is an alternative proposal to adding more precision by default. curl#1106
I just finished draft2 of this, if the feature window hasn't closed yet and there is interest. I still need a test.
Conceivably in Linux and cygwin it should work on 3>foo and if %{flags:fd3} the write-out text will go there. It won't work in Windows. |
I think we can just leave the digits as they are as nobody has reported any problems with this change so far. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Ok |
in order to provide more detailed performance statistics, I changed the printf to use 6 decimals.
Luckily enough the metrics were already using double integers.