Skip to content

Commit

Permalink
Merge pull request #1759 from ChoKyuWon/master
Browse files Browse the repository at this point in the history
Refactor the kernel depth option and documentation.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
  • Loading branch information
namhyung committed Jul 23, 2023
2 parents 9dd6520 + ca2a873 commit 2f6302c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
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

0 comments on commit 2f6302c

Please sign in to comment.