Skip to content
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

libbpf-rs: Update docs in query.rs #1116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

syogaraj
Copy link
Contributor

@syogaraj syogaraj commented Mar 7, 2025

No description provided.

pub xlated_prog_insns: Vec<u8>,
/// Duration since system boot
/// Duration since system boot when the program was loaded.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should NOT be interpreted as duration. It should be an Instant instead.
This comment is completely misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Time (since system boot) at which the program was loaded". Is this correct?
Also, should we change the Duration::from_nanos(item.load_time) logic to calculate the correct time? I think we should keep the value as it is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

All "documentation" I found says: "ns since boottime", which strikes me as very similar to what we had. Personally, I'd leave it the way it was, including keeping it as Duration. If it's misleading then it is misleading in the kernel as well, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can use bpftool as a reference.

Copy link
Collaborator

@danielocfb danielocfb left a comment

Choose a reason for hiding this comment

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

Definitely a good improvement; thanks again! Left a few comments, please take another look.

Comment on lines 632 to 633
/// Length (in bytes) of the raw tracepoint name
pub name_len: u32,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this member needed? We do have the name and it has a length, no? This seems like useless duplication of information to me.

pub xlated_prog_insns: Vec<u8>,
/// Duration since system boot
/// Duration since system boot when the program was loaded.
Copy link
Collaborator

Choose a reason for hiding this comment

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

All "documentation" I found says: "ns since boottime", which strikes me as very similar to what we had. Personally, I'd leave it the way it was, including keeping it as Duration. If it's misleading then it is misleading in the kernel as well, no?

pub prog_tags: Vec<Tag>,
/// Total accumulated run time (in nanoseconds) for the program’s execution.
pub run_time_ns: u64,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, looking at it this should probably be a Duration. But of course you didn't change the type so it's fine to keep for now. Just pointing it out in case you want to fix it up subsequently.

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.

3 participants