Skip to content

Commit b86599e

Browse files
committed
trace-cmd stat: Add sub-buffer size
Show the sub-buffer size if the file system supports it and it is different than the architecture page size. This requires libtracefs 1.8, so update the Makefile with that requirement. Link: https://lore.kernel.org/linux-trace-devel/20240108184123.62f9be6b@gandalf.local.home Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 7d8b3c0 commit b86599e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export LIBTRACECMD_VERSION
2323
VERSION_FILE = ltc_version.h
2424

2525
LIBTRACEEVENT_MIN_VERSION = 1.5
26-
LIBTRACEFS_MIN_VERSION = 1.6
26+
LIBTRACEFS_MIN_VERSION = 1.8
2727

2828
MAKEFLAGS += --no-print-directory
2929

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ htmldir = join_paths(prefixdir, get_option('htmldir'))
2525
conf = configuration_data()
2626

2727
libtraceevent_dep = dependency('libtraceevent', version: '>= 1.5.0', required: true)
28-
libtracefs_dep = dependency('libtracefs', version: '>= 1.6.0', required: true)
28+
libtracefs_dep = dependency('libtracefs', version: '>= 1.8.0', required: true)
2929

3030
threads_dep = dependency('threads', required: true)
3131
dl_dep = cc.find_library('dl', required : false)

tracecmd/trace-stat.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ static void report_buffers(struct buffer_instance *instance)
633633
char *str;
634634
char *cont;
635635
char file[FILE_SIZE];
636+
int pagesize;
637+
int bufsize;
636638
int cpu;
637639

638640
str = tracefs_instance_file_read(instance->tracefs, "buffer_size_kb", NULL);
@@ -678,6 +680,11 @@ static void report_buffers(struct buffer_instance *instance)
678680
printf("\nBuffer total size in kilobytes:\n");
679681
printf(" %s\n", str);
680682

683+
pagesize = getpagesize();
684+
bufsize = tracefs_instance_get_subbuf_size(instance->tracefs);
685+
if (bufsize > 0 && bufsize * 1024 != pagesize)
686+
printf("\nSub-buffer size in kilobytes:\n %d\n", bufsize);
687+
681688
out:
682689
free(str);
683690
}

0 commit comments

Comments
 (0)