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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmds/record.c
Expand Up @@ -1782,7 +1782,7 @@ static void setup_writers(struct writer_data *wd, struct uftrace_opts *opts)

kernel->pid = wd->pid;
kernel->output_dir = opts->dirname;
kernel->depth = opts->kernel_depth ?: 1;
kernel->depth = opts->kernel_depth;
kernel->bufsize = opts->kernel_bufsize;
kernel->clock = opts->clock;

Expand Down
6 changes: 3 additions & 3 deletions doc/uftrace-record.md
Expand Up @@ -62,9 +62,9 @@ RECORD OPTIONS
library call from the main executable. Implies `--force`.

-k, \--kernel
: Trace kernel functions as well as user functions. Only kernel entry/exit
functions will be traced by default. Use the `--kernel-depth` option to
override this.
: Trace kernel functions as well as user functions. By default, the tracing
depth is 1 (Only kernel entry/exit functions will be traced).
Use the `-K`/`--kernel-depth` option to override this.

-K *DEPTH*, \--kernel-depth=*DEPTH*
: Set kernel max function depth separately. Implies `--kernel`.
Expand Down
5 changes: 3 additions & 2 deletions uftrace.c
Expand Up @@ -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);
opts->kernel_depth = 0;
pr_use("invalid kernel depth: %s. Set depth to 1.\n", arg);
opts->kernel_depth = 1;
}
break;

Expand Down