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

Report: Support max/min timestamp in report output #1925

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

Conversation

Cosh-y
Copy link

@Cosh-y Cosh-y commented May 12, 2024

Hi @namhyung

According to the requirements in the issue #1898 , I have currently made a simple addition of four optional output fields: total-min-ts, total-max-ts, self-min-ts, and self-max-ts. Due to the longer field names, I have adjusted the output format accordingly.

The current problem is that the timestamp's starting time seems too early, resulting in excessively large timestamps. Additionally, the code hasn't passed through the pipeline yet, so I will further investigate the problem.

I hope you could review my work and provide valuable feedback.

Thank you very much!

This patch introduces timestamps for special function calls that take
the minimum or maximum time.
With this capability, users can identify function calls that exhibit
unusual execution times and investigate the underlying reasons.

Example usage:

$ uftrace report -f total-min-ts,total-max-ts
  Total min ts  Total max ts  Function
  ============  ============  ====================
     12.009  h     12.009  h  main
     12.009  h     12.009  h  printf
     12.009  h     12.009  h  __monstartup
     12.009  h     12.009  h  __cxa_atexit

Resolves: namhyung#1898

Signed-off-by: Hanyu Cui <[email protected]>
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. Patch looks fine. I've left some comments below.

REPORT_F_SELF_TIME_MAX,
REPORT_F_SELF_TIME_MAX_TS,
Copy link
Owner

Choose a reason for hiding this comment

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

Adding new fields in the middle created some problems. Let's add them after the STDV fields.

static void print_##_func(struct field_data *fd) \
{ \
struct uftrace_report_node *node = fd->arg; \
print_time_unit_padding(node->_field, 2); \
Copy link
Owner

Choose a reason for hiding this comment

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

Nop, timestamp should not be printed using print_time_unit(). Please add something similar to print_timestamp() in cmds/replay.c file.

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.

None yet

2 participants