1libtracefs(3) 2============= 3 4NAME 5---- 6tracefs_options_get_supported, tracefs_option_is_supported, tracefs_options_get_enabled, 7tracefs_option_is_enabled, tracefs_option_mask_is_set, tracefs_option_id 8- Get and check ftrace options. 9 10SYNOPSIS 11-------- 12[verse] 13-- 14*#include <tracefs.h>* 15 16const struct tracefs_options_mask pass:[*]*tracefs_options_get_supported*(struct tracefs_instance pass:[*]_instance_); 17bool *tracefs_option_is_supported*(struct tracefs_instance pass:[*]_instance_, enum tracefs_option_id _id_); 18const struct tracefs_options_mask pass:[*]*tracefs_options_get_enabled*(struct tracefs_instance pass:[*]_instance_); 19bool *tracefs_option_is_enabled*(struct tracefs_instance pass:[*]_instance_, enum tracefs_option_id _id_); 20bool *tracefs_option_mask_is_set*(const struct tracefs_options_mask *options, enum tracefs_option_id id); 21enum tracefs_option_id *tracefs_option_id*(const char pass:[*]_name_); 22-- 23 24DESCRIPTION 25----------- 26This set of APIs can be used to get and check current ftrace options. Supported ftrace options may 27depend on the kernel version and the kernel configuration. 28 29The *tracefs_options_get_supported()* function gets all ftrace options supported by the system in 30the given _instance_. If _instance_ is NULL, supported options of the top trace instance are 31returned. The set of supported options is the same in all created trace instances, but may be different 32than the top trace instance. 33 34The *tracefs_option_is_supported()/ function checks if the option with given _id_ is supported by 35the system in the given _instance_. If _instance_ is NULL, the top trace instance is used. If an 36option is supported at the top trace instance, it it may not be supported in a created trace instance. 37 38The *tracefs_options_get_enabled()* function gets all ftrace options, currently enabled in 39the given _instance_. If _instance_ is NULL, enabled options of the top trace instance are returned. 40 41The *tracefs_option_is_enabled()* function checks if the option with given _id_ is enabled in the 42given _instance_. If _instance_ is NULL, the top trace instance is used. 43 44The *tracefs_option_mask_is_set()* function checks if the bit, corresponding to the option with _id_ is 45set in the _options_ bitmask returned from *tracefs_option_get_enabled()* and *tracefs_option_is_supported()*. 46 47The *tracefs_option_id()* converts an option _name_ into its corresponding id, if it is found. 48This allows to find the option _id_ to use in the other functions if only the _name_ is known. 49 50RETURN VALUE 51------------ 52The *tracefs_options_get_supported()* and *tracefs_options_get_enabled()* functions, on success, 53return a pointer to the bitmask within the instance, or a global bitmask for the top level, 54or NULL in case of an error. As the returned bitmask is part of the instance structure (or a 55global variable) and must not be freed or modified. 56 57The *tracefs_option_is_supported()* and *tracefs_option_is_enabled()* functions return true if the 58option in supported / enabled, or false otherwise. 59 60The *tracefs_option_mask_is_set()* returns true if the corresponding option is set in the mask 61or false otherwise. 62 63The *tracefs_option_id()* returns the corresponding id defined by *tracefs_options*(3) from 64the given _name_. If the _name_ can not be found, then TRACEFS_OPTION_INVALID is returned. 65 66EXAMPLE 67------- 68[source,c] 69-- 70#include <tracefs.h> 71... 72const struct tracefs_options_mask *options; 73... 74options = tracefs_options_get_supported(NULL); 75if (!options) { 76 /* Failed to get supported options */ 77} else { 78 ... 79} 80... 81options = tracefs_options_get_enabled(NULL); 82if (!options) { 83 /* Failed to get options, enabled in the top instance */ 84} else { 85 ... 86} 87if (tracefs_options_mask_is_set(options, TRACEFS_OPTION_LATENCY_FORMAT)) { 88 ... 89} 90... 91 92if (tracefs_option_is_supported(NULL, TRACEFS_OPTION_LATENCY_FORMAT)) { 93 /* Latency format option is supprted */ 94} 95 96... 97 98if (tracefs_option_is_enabled(NULL, TRACEFS_OPTION_STACKTRACE)) { 99 /* Stacktrace option is enabled in the top instance */ 100} 101 102-- 103FILES 104----- 105[verse] 106-- 107*tracefs.h* 108 Header file to include in order to have access to the library APIs. 109*-ltracefs* 110 Linker switch to add when building a program that uses the library. 111-- 112 113SEE ALSO 114-------- 115*libtracefs*(3), 116*libtraceevent*(3), 117*trace-cmd*(1) 118 119AUTHOR 120------ 121[verse] 122-- 123*Steven Rostedt* <[email protected]> 124*Tzvetomir Stoyanov* <[email protected]> 125-- 126REPORTING BUGS 127-------------- 128Report bugs to <[email protected]> 129 130LICENSE 131------- 132libtracefs is Free Software licensed under the GNU LGPL 2.1 133 134RESOURCES 135--------- 136https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ 137 138COPYING 139------- 140Copyright \(C) 2020 VMware, Inc. Free use of this software is granted under 141the terms of the GNU Public License (GPL). 142