diff mbox series

trace-cmd stat: Add sub-buffer size

Message ID 20231228222008.2742615a@rorschach.local.home (mailing list archive)
State Superseded
Headers show
Series trace-cmd stat: Add sub-buffer size | expand

Commit Message

Steven Rostedt Dec. 29, 2023, 3:20 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

[
  Note, this depends on libtracefs 1.8 and can not be added until
  that's released.
]

Show the sub-buffer size if the file system supports it and it is different
than the architecture page size.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tracecmd/trace-stat.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-stat.c b/tracecmd/trace-stat.c
index 9a6e22254b48..1d95d9934b47 100644
--- a/tracecmd/trace-stat.c
+++ b/tracecmd/trace-stat.c
@@ -633,6 +633,8 @@  static void report_buffers(struct buffer_instance *instance)
 	char *str;
 	char *cont;
 	char file[FILE_SIZE];
+	int pagesize;
+	int bufsize;
 	int cpu;
 
 	str = tracefs_instance_file_read(instance->tracefs, "buffer_size_kb", NULL);
@@ -678,6 +680,11 @@  static void report_buffers(struct buffer_instance *instance)
 	printf("\nBuffer total size in kilobytes:\n");
 	printf("   %s\n", str);
 
+	pagesize = getpagesize();
+	bufsize = tracefs_instance_get_subbuf_size(instance->tracefs);
+	if (bufsize > 0 && bufsize * 1024 != pagesize)
+		printf("\nSub-buffer size in kilobytes:\n   %d\n", bufsize);
+
  out:
 	free(str);
 }