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

Refactor the kernel depth option and documentation #1759

Merged
merged 2 commits into from Jul 23, 2023

Conversation

ChoKyuWon
Copy link
Contributor

To process the -k option, the kernel_depth in opt field is not set and is set to 1 when used (setup_writers).
This PR initializes the opts->kernel_depth to 1 at the case -k and -K if the input value is invalid.

This refactoring clarifies the code semantic when the user only uses the -k, and invalid -K.

@paranlee
Copy link
Contributor

paranlee commented Jul 13, 2023

Hello, @ChoKyuWon. Thank you for the first patch on OSSCA 2023!

I thought we might want to have a discussion about this PR before. Would you open issue on this PR contents?

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.

Looks good, but we could improve the message a little bit.

uftrace.c Outdated
@@ -655,14 +655,15 @@ static int parse_option(struct uftrace_opts *opts, int key, char *arg)

case 'k':
opts->kernel = true;
opts->kernel_depth = 1;
break;

case 'K':
opts->kernel = true;
opts->kernel_depth = strtol(arg, NULL, 0);
if (opts->kernel_depth < 1 || opts->kernel_depth > 50) {
pr_use("invalid kernel depth: %s (ignoring...)\n", arg);
Copy link
Owner

Choose a reason for hiding this comment

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

You can say "set to 1" instead of "(ignoring...)".

@ChoKyuWon ChoKyuWon force-pushed the master branch 3 times, most recently from 98687fd to e9c3205 Compare July 16, 2023 07:13
initialize the opts->kernel_depth to 1 in '-k' and remove the ternary
operator in setup_writers.

Signed-off-by: ChoKyuWon <kyuwoncho18@gmail.com>
Signed-off-by: ChoKyuWon <kyuwoncho18@gmail.com>
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.

LGTM

@namhyung namhyung merged commit 2f6302c into namhyung:master Jul 23, 2023
3 checks passed
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

3 participants