# libtracefs(3) Manual Page

## NAME

tracefs_instance_get_subbuf_size, tracefs_instance_set_subbuf_size - Helper functions for working with ring buffer sub buffers.

## SYNOPSIS

    #include <tracefs.h>

    size_t tracefs_instance_get_subbuf_size(struct tracefs_instance *instance);
    int tracefs_instance_set_subbuf_size(struct tracefs_instance *instance, size_t size);

## DESCRIPTION

Helper functions for working with the sub-buffers of the tracing ring buffer. The tracing ring buffer is broken up into sub-buffers. An event can not be bigger than the data section of the sub-buffer (see tep_get_sub_buffer_data_size(3)). By default, the ring buffer uses the architectures page_size as the default size of the sub-buffer, but this can be limiting if there is a need for large events, for example, the application wants to write large strings into the trace_marker file.

The tracefs_instance_get_subbuf_size() returns the current size in kilobytes fo the ring buffer sub-buffers.

The tracefs_instance_set_subbuf_size() will write the size in kilobytes of what the new sub-buffer size should be. Note, that this is only a hint to what the minimum sub-buffer size should be. It also does not take into account the meta-data that is used by the sub-buffer, so the size written should be no less than 16 bytes more than the maximum event size that will be used. The kernel will likely make the sub-buffer size larger than specified, as it may need to align the size for implementation purposes.

## RETURN VALUE

The tracefs_instance_get_subbuf_size() returns the size of the current sub-buffer for the given instance ring buffer or -1 on error.

The tracefs_instance_set_subbuf_size() will return 0 if it successfully set the instance ring buffer sub-buffer size in kilobytes, or -1 on error.

## EXAMPLE

## FILES

    tracefs.h
            Header file to include in order to have access to the library APIs.
    -ltracefs
            Linker switch to add when building a program that uses the library.

## SEE ALSO

libtracefs(3), libtraceevent(3), trace-cmd(1)

## AUTHOR

    Steven Rostedt <rostedt@goodmis.org>
    Tzvetomir Stoyanov <tz.stoyanov@gmail.com>

## REPORTING BUGS

Report bugs to <linux-trace-devel@vger.kernel.org>

## LICENSE

libtracefs is Free Software licensed under the GNU LGPL 2.1

## RESOURCES

https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/

## COPYING

Copyright (C) 2020 VMware, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).