Skip to content

add microsecond precise timers for measuring various intervals - #2495

Closed
pprindeville wants to merge 1 commit into
curl:masterfrom
pprindeville:add-integer-times
Closed

pprindeville wants to merge 1 commit into
curl:masterfrom
pprindeville:add-integer-times

Conversation

@pprindeville

Copy link
Copy Markdown
Contributor

Work in progress.

Trying to make the definition of CURLINFO_TOTAL_TIME_T, et al be conditional on whether CURL_SIZEOF_CURL_OFF_T == 8 or not.

CURL_SIZEOF_CURL_OFF_T is defined in lib/curl_setup.h but that's not included in curl/curl.h... investigating a work-around.

@pprindeville
pprindeville force-pushed the add-integer-times branch 2 times, most recently from da3f93c to cd37983 Compare April 15, 2018 20:56
@bagder

bagder commented Apr 16, 2018

Copy link
Copy Markdown
Member
../../include/curl/curl.h:2530:5: warning: "CURL_SIZEOF_CURL_OFF_T" is not defined [-Wundef]
 #if CURL_SIZEOF_CURL_OFF_T == 8
     ^

CURL_SIZEOF_CURL_OFF_T is not defined by the global public curl headers so you can't rely on that in there! But that I don't think you should add ifdef-conditional options to begin with so just remove the ifdef...

@pprindeville

Copy link
Copy Markdown
Contributor Author

But that I don't think you should add ifdef-conditional options to begin with so just remove the ifdef...

Done.

@pprindeville

Copy link
Copy Markdown
Contributor Author

Any other blockers?

@bagder

bagder commented Apr 19, 2018

Copy link
Copy Markdown
Member

The CI builds are still red so I haven't really checked out the details.

progressfunc.c:52:3: error: conversion to ‘double’ from ‘curl_off_t’ may alter its value [-Werror=conversion]
   if((curtime - myp->lastruntime) >= MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL) {
   ^
progressfunc.c:53:5: error: conversion to ‘double’ from ‘curl_off_t’ may alter its value [-Werror=conversion]
     myp->lastruntime = curtime;
     ^

@pprindeville
pprindeville force-pushed the add-integer-times branch 2 times, most recently from ada1661 to 558174d Compare April 19, 2018 23:47
@pprindeville

Copy link
Copy Markdown
Contributor Author

The CI builds are still red so I haven't really checked out the details.

Saw some errors, yeah, but I thought they were pre-existing. But you're right, the above was introduced by my changes. Fixing it now.

@pprindeville

Copy link
Copy Markdown
Contributor Author

Also failed the symbols-in-versions test (1119). Fixed that.

@pprindeville

Copy link
Copy Markdown
Contributor Author

@bagder Does Travis build each commit in a PR separately or just the last one?

I fixed the issue that you pointed out above, then it built but failed elsewhere (with the missing versioning of the new symbols) so I fixed that... now it's back to failing at the above place. Weird.

@pprindeville
pprindeville force-pushed the add-integer-times branch 2 times, most recently from eb924bf to 924da0b Compare April 20, 2018 19:36

@bagder bagder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this looks great, I only have a few comments and questions to ponder.

Comment thread docs/examples/progressfunc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't this look nicer if instead the constant MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL was multiplied with 1000000 ?

Comment thread lib/getinfo.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why limit these to 64bit only?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, since it's a relative timestamp and not absolute, sure, I'll make it 32-bit as well.

Comment thread include/curl/curl.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These might be handy for an application, but they're also very basic and for very specific and narrow use cases. Does it really add anything to provide them in the public header?

To me they feel more like handy macros for our test suite.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, since other format specifiers were exposed in system.h I was trying to follow that model.

Comment thread tests/libtest/lib500.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since you limited the code to extract this time to 64 bit only, won't this code fail hard on 32 bit systems?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made it 32-bit also.

Comment thread docs/libcurl/symbols-in-versions Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the feature window has closed now for 7.60.0 and this is a change, we can assume this change can land in 7.61.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed... the Travis testing is kicking my ass, though... Can't get it to pass the tests 1139 and 1140.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see it in the most recent commit. I see it fails because of this:

lib500.c: In function ‘test’:
lib500.c:115:112: error: expected identifier before ‘%’ token
           fprintf(moo, "namelookup vs connect: %" CURL_FORMAT_CURL_OFF_T ".%06ld " %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
             

there's a quote in middle of the ".%06ld " %" which it looks like causes a slew of syntax errors

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@pprindeville
pprindeville force-pushed the add-integer-times branch 6 times, most recently from 5f0e463 to 678268f Compare April 21, 2018 04:05
@pprindeville

Copy link
Copy Markdown
Contributor Author

Not understanding what's needed here:

test 1139...[Verify that all libcurl options have man pages]

perl  returned 7, when expecting 0
 exit FAILED
== Contents of files in the log/ dir after test 1139
=== Start of file stderr1139
 Missing CURLINFO_APPCONNECT_TIME_T.3
 Missing CURLINFO_CONNECT_TIME_T.3
 Missing CURLINFO_NAMELOOKUP_TIME_T.3
 Missing CURLINFO_PRETRANSFER_TIME_T.3
 Missing CURLINFO_REDIRECT_TIME_T.3
 Missing CURLINFO_STARTTRANSFER_TIME_T.3
 Missing CURLINFO_TOTAL_TIME_T.3
=== End of file stderr1139
test 1140...[Verify the nroff of man pages]

perl  returned 7, when expecting 0
 exit FAILED
== Contents of files in the log/ dir after test 1140
=== Start of file stderr1140
 error: ./../docs/libcurl/curl_easy_getinfo.3:65: referring to non-existing man page CURLINFO_TOTAL_TIME_T.3
 error: ./../docs/libcurl/curl_easy_getinfo.3:71: referring to non-existing man page CURLINFO_NAMELOOKUP_TIME_T.3
 error: ./../docs/libcurl/curl_easy_getinfo.3:77: referring to non-existing man page CURLINFO_CONNECT_TIME_T.3
 error: ./../docs/libcurl/curl_easy_getinfo.3:83: referring to non-existing man page CURLINFO_APPCONNECT_TIME_T.3
 error: ./../docs/libcurl/curl_easy_getinfo.3:89: referring to non-existing man page CURLINFO_PRETRANSFER_TIME_T.3
 error: ./../docs/libcurl/curl_easy_getinfo.3:95: referring to non-existing man page CURLINFO_STARTTRANSFER_TIME_T.3
 error: ./../docs/libcurl/curl_easy_getinfo.3:101: referring to non-existing man page CURLINFO_REDIRECT_TIME_T.3
=== End of file stderr1140

@jay

jay commented Apr 21, 2018

Copy link
Copy Markdown
Member

because it's not documented, you need man pages for each. how is CURLINFO_APPCONNECT_TIME different from CURLINFO_APPCONNECT_TIME_T

@pprindeville

Copy link
Copy Markdown
Contributor Author

Can we have the *TIME and *TIME_T versions share the same pages?

@pprindeville
pprindeville force-pushed the add-integer-times branch 4 times, most recently from f5e2890 to d33b20f Compare April 28, 2018 21:26
@pprindeville
pprindeville force-pushed the add-integer-times branch 2 times, most recently from 5d33f05 to 62a1d5a Compare April 28, 2018 22:53
@pprindeville

Copy link
Copy Markdown
Contributor Author

I think the PR is good to go. @jay @bagder?

We overload the curl_off_t, if it's 64-bits wide, for extending
the API to allow retrieving times in microseconds (which is how
they're stored internally).
@jay

jay commented May 2, 2018

Copy link
Copy Markdown
Member

I'll check it again it looks like you did more work on it. Even if approved it can't be added until the next feature window, in 2 weeks.

@pprindeville

Copy link
Copy Markdown
Contributor Author

When does the window reopen?

@bagder

bagder commented May 17, 2018

Copy link
Copy Markdown
Member

At release, which was yesterday!

@bagder

bagder commented May 17, 2018

Copy link
Copy Markdown
Member

Thanks!

@bagder bagder closed this in ce2140a May 17, 2018
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants