-
Notifications
You must be signed in to change notification settings - Fork 112
Introduce time #388
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
Introduce time #388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @tatsuhiro-t, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request integrates a robust timekeeping mechanism into the library, enabling the tracking of events with nanosecond precision. It introduces new data types for timestamps and durations, along with utility macros for common time units. The nghttp3_settings
structure has been enhanced to allow for an initial timestamp, and a new stream reading function, nghttp3_conn_read_stream2
, has been added to leverage this new timing capability, replacing its predecessor.
Highlights
- New Time Types and Macros: Introduced
nghttp3_tstamp
andnghttp3_duration
types for nanosecond resolution time, along with convenience macros likeNGHTTP3_NANOSECONDS
,NGHTTP3_MICROSECONDS
,NGHTTP3_MILLISECONDS
, andNGHTTP3_SECONDS
. - Extended
nghttp3_settings
: Thenghttp3_settings
structure has been extended with a newinitial_ts
field, allowing applications to provide an initial timestamp to the library. - Deprecated
nghttp3_conn_read_stream
: The functionnghttp3_conn_read_stream
has been deprecated in favor ofnghttp3_conn_read_stream2
, which now accepts annghttp3_tstamp
parameter for more precise timing of stream data processing. - Settings Version Update: The internal settings version has been updated to
NGHTTP3_SETTINGS_V3
to reflect the new additions and changes.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces time-related data types and functionality to the library, including nanosecond-resolution timestamps and durations. The changes are well-implemented across the API, documentation, and tests. A new function nghttp3_conn_read_stream2
is added to accept a timestamp, and the old function is deprecated. My review found one potential issue in the new timestamp handling logic that could lead to state corruption, for which I've provided a suggestion.
bb7203f
to
9c70476
Compare
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces time-related data types and functions to enable tracking of events over time. The changes include new typedefs for timestamp and duration, an initial_ts
field in nghttp3_settings
, and a new nghttp3_conn_read_stream2
function that accepts a timestamp. The existing nghttp3_conn_read_stream
is deprecated. The implementation is consistent across the library, documentation, and tests. I have one suggestion to improve the robustness of the versioned settings struct size calculation.
return offsetof(nghttp3_settings, origin_list) + | ||
sizeof(settings.origin_list); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using offsetof
with the first field of the next version is a more robust way to determine the size of a versioned struct, as it correctly handles potential compiler padding between members. The current approach of offsetof(last_field) + sizeof(last_field)
can be incorrect if there's padding after last_field
.
return offsetof(nghttp3_settings, initial_ts);
This commit introduces time to count certain events in specific duration of time. nghttp3_tstamp is the time instant, and nghttp3_duration is the duration of time. Both are nanosecond resolution. Some macros such as NGHTTP3_SECONDS have been introduced for convenience. nghttp3_settings has been extended, and an application should set the initial timestamp to initial_ts field. nghttp3_conn_read_stream has been deprecated in favor of nghttp3_conn_read_stream2 which takes nghttp3_tstamp as a final parameter.
This commit introduces time to count certain events in specific duration of time.
nghttp3_tstamp is the time instant, and nghttp3_duration is the duration of time. Both are nanosecond resolution. Some macros such as NGHTTP3_SECONDS have been introduced for convenience.
nghttp3_settings has been extended, and an application should set the initial timestamp to initial_ts field.
nghttp3_conn_read_stream has been deprecated in favor of nghttp3_conn_read_stream2 which takes nghttp3_tstamp as a final parameter.