Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gfx
Copy link
Collaborator

@gfx gfx commented Apr 24, 2020

The current "time" field is millisecond-resolution, but it is not correctly sortable. Also, qlog can deal with usec resolution, so it is useful to provide hi-resolution time for later analysis.

I'd like to keep the "time" field for compatibility with other tools that use quicly probes directly: https://github.com/h2o/quicly/tree/master/misc

@gfx gfx force-pushed the hires_time branch 2 times, most recently from 49951db to 05afe56 Compare April 24, 2020 02:11
@gfx
Copy link
Collaborator Author

gfx commented Apr 24, 2020

Changed names as h2o/h2o#2053 (comment) suggested.

Copy link
Owner

@toru toru left a comment

Choose a reason for hiding this comment

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

Good call on using the POSIX clock_gettime() instead.

@gfx gfx changed the title add "time-ns" field for nanosecond-resolution time add "time-nanosec" field for nanosecond-resolution time Apr 24, 2020
@gfx
Copy link
Collaborator Author

gfx commented Apr 24, 2020

I already use clock_gettime(CLOCK_REALTIME, ...) here 😉

@gfx
Copy link
Collaborator Author

gfx commented Apr 24, 2020

@syohex san suggested we can use C++ standard library for this purpose. https://twitter.com/syohex/status/1253527261896032256

@toru
Copy link
Owner

toru commented Apr 24, 2020

I like this PR as-is because it's an idiomatic use of the POSIX clock_gettime(). That said, this is a very hot code path. If std::chrono gives us perf benefits, I have no objections to using it.

@syohex
Copy link
Contributor

syohex commented Apr 24, 2020

If std::chrono gives us perf benefit

I suppose there is no performance benefit. Because std::chrono API is only wrapper function of clock_gettime on Unix like system. For example std::chrono::system_clock::now implementation is below. This increases some function/constructor calls overhead. I suppose they are inlined by compiler optimization however more instructions are necessary rather than calling clock_gettime directly.

  struct timespec tp;
  if (0 != clock_gettime(CLOCK_REALTIME, &tp))
    __throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
  return time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000));

Copy link
Contributor

@kazuho kazuho left a comment

Choose a reason for hiding this comment

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

The current "time" field is millisecond-resolution, but it is not correctly sortable. Also, qlog can deal with usec resolution, so it is useful to provide hi-resolution time for later analysis.

I disagree about this rationale. To diagnose, what we need is the time that the transport uses. Not the actual time. Using something different than what quicly believes to be true is going to cause confusion.

PS. I also do not think that the fields would become sortable when we change the resolution to nanoseconds. If we want to sort, we need a logical clock. But I would appreciate it if you could clarify why we need to sort. Aren't the events logged in the order they are submitted?

@toru
Copy link
Owner

toru commented Apr 24, 2020

Skew from not using the server time does sound real. This brings up another topic that it looks like we stopped using quicly's at/time value at some point.

@toru
Copy link
Owner

toru commented Apr 24, 2020

Please dismiss my comment from above. We do use at where possible from quicly. I had forgotten that there are non-quicly probes in the QUIC tracer.

@gfx
Copy link
Collaborator Author

gfx commented May 7, 2020

Thanks to @kazuho, I've realized there are two problems with this PR:

  1. CLOCK_REALTIME is not suitable to keep the exact order, so we have to use another stuff for sorting
  2. CLOCK_REALTIME is not what exactly quicly emits, so we have to use at field as a timestamp

Considering another way.

@gfx gfx closed this May 7, 2020
@gfx gfx deleted the hires_time branch May 7, 2020 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants