libtracefs: Updates to the histograms for tracefs_sql()
v2 cover libtracefs: Updates to the histograms for tracefs_sql()
From: "Steven Rostedt (VMware)" <[email protected]>
In preparation for tracefs_sql(), the histogram logic needs some updates. Restructure the API a little better. Since the API has not been part of a tagged release, it is still allowed to change.
Add a way to show a partially created synthetic event, which can be used by tracefs_sql() for creating histograms.
Changes since v1:
- Fixed tracefs_synth_get_start_hist() when more than one key existed.
Steven Rostedt (VMware) (7):
libtracefs: Change the tracefs_hist API to not take an instance
immediately
libtracefs: Expose tracefs_hist_command() as an API
libtracefs: Add API tracefs_hist_append_filter()
libtracefs: Add API tracefs_hist_show()
libtracefs: Split up libtracefs-synth man page
libtracefs: Add API tracefs_synth_get_start_hist()
libtracefs: Add API tracefs_synth_complete()
Documentation/libtracefs-hist.txt | 105 +++++++-- Documentation/libtracefs-synth.txt | 31 +-- Documentation/libtracefs-synth2.txt | 247 +++++++++++++++++++++ include/tracefs.h | 148 ++++++++++--- src/tracefs-hist.c | 326 +++++++++++++++++----------- 5 files changed, 665 insertions(+), 192 deletions(-) create mode 100644 Documentation/libtracefs-synth2.txt
Signature · 1 line
2.30.2
PATCH v2 1/7 libtracefs: Change the tracefs_hist API to not take an instance immediately
From: "Steven Rostedt (VMware)" <[email protected]>
After implementing tracefs_sql(), it became apparent that passing the instance into the tracefs_hist API to create the descriptor was the wrong approach. It's better to just pass in a tep_handle for verification purposes, and then have the user pass in the instance when creating the histogram. This also allows to easily create the same histogram in different instances if need be.
--- Documentation/libtracefs-hist.txt | 40 +++++++++++------- include/tracefs.h | 16 ++++---- src/tracefs-hist.c | 68 +++++++++++++++++-------------- 3 files changed, 71 insertions(+), 53 deletions(-)
Documentation/libtracefs-hist.txt +26 -14
@@ -12,7 +12,7 @@ SYNOPSIS -- *#include <tracefs.h>* -struct tracefs_hist pass:[*]tracefs_hist_alloc(struct tracefs_instance pass:[*] instance, +struct tracefs_hist pass:[*]tracefs_hist_alloc(struct tracefs_tep pass:[*] tep, const char pass:[*]system, const char pass:[*]event, const char pass:[*]key, enum tracefs_hist_key_type type); void tracefs_hist_free(struct tracefs_hist pass:[*]hist);
@@ -25,8 +25,8 @@ int tracefs_hist_sort_key_direction(struct tracefs_hist pass:[*]hist, const char pass:[*]sort_key, enum tracefs_hist_sort_direction dir); int tracefs_hist_add_name(struct tracefs_hist pass:[*]hist, const char pass:[*]name); -int tracefs_hist_start(struct tracefs_hist pass:[*]hist); -int tracefs_hist_destory(struct tracefs_hist pass:[*]hist); +int tracefs_hist_start(struct tracefs_instance pass:[*]instance, struct tracefs_hist pass:[*]hist); +int tracefs_hist_destory(struct tracefs_instance pass:[*]instance, struct tracefs_hist pass:[*]hist); -- DESCRIPTION
@@ -38,10 +38,11 @@ See https://www.kernel.org/doc/html/latest/trace/histogram.html for more informa *tracefs_hist_alloc*() allocates a "struct tracefs_hist" descriptor and returns the address of it. This descriptor must be freed by *tracefs_hist_free*(). -The _instance_ is the instance that contains the event that the histogram will be -attached to. The _system_ is the system or group of the event. The _event_ is the event -to attach the histogram to. The _key_ is a field of the event that will be used as -the key of the histogram. The _type_ is the type of the _key_. See KEY TYPES below. +The _tep_ is a trace event handle (see *tracefs_local_events*(3)), that holds the +_system_ and _event_ that the histogram will be attached to. The _system_ is the +system or group of the event. The _event_ is the event to attach the histogram to. +The _key_ is a field of the event that will be used as the key of the histogram. +The _type_ is the type of the _key_. See KEY TYPES below. *tracefs_hist_free*() frees the _tracefs_hist_ descriptor. Note, it does not stop or disable the running histogram if it was started. *tracefs_hist_destroy*() needs
@@ -81,15 +82,24 @@ into a single histogram (shown by either event's hist file). The _hist_ is the histogram to name, and the _name_ is the name to give it. *tracefs_hist_start* is called to actually start the histogram _hist_. +The _instance_ is the instance to start the histogram in, NULL if it +should start at the top level. *tracefs_hist_pause* is called to pause the histogram _hist_. +The _instance_ is the instance to pause the histogram in, NULL if it +is in the top level. *tracefs_hist_continue* is called to continue a paused histogram _hist_. +The _instance_ is the instance to continue the histogram, NULL if it +is in the top level. *tracefs_hist_reset* is called to clear / reset the histogram _hist_. +The _instance_ is the instance to clear the histogram, NULL if it +is in the top level. *tracefs_hist_destory* is called to delete the histogram where it will no longer -exist. +exist. The _instance_ is the instance to delete the histogram from, NULL if it +is in the top level. KEY TYPES
@@ -152,6 +162,7 @@ int main (int argc, char **argv, char **env) { struct tracefs_instance *instance; struct tracefs_hist *hist; + struct tep_handle *tep; enum commands cmd; char *cmd_str; int ret;
@@ -186,7 +197,8 @@ int main (int argc, char **argv, char **env) exit(-1); } - hist = tracefs_hist_alloc(instance, "kmem", "kmalloc", + tep = tracefs_local_events(NULL); + hist = tracefs_hist_alloc(tep, "kmem", "kmalloc", "call_site", TRACEFS_HIST_KEY_SYM); if (!hist) { fprintf(stderr, "Failed hist create\n");
@@ -208,7 +220,7 @@ int main (int argc, char **argv, char **env) switch (cmd) { case START: - ret = tracefs_hist_start(hist); + ret = tracefs_hist_start(instance, hist); if (ret) { char *err = tracefs_error_last(instance); if (err)
@@ -216,16 +228,16 @@ int main (int argc, char **argv, char **env) } break; case PAUSE: - ret = tracefs_hist_pause(hist); + ret = tracefs_hist_pause(instance, hist); break; case CONT: - ret = tracefs_hist_continue(hist); + ret = tracefs_hist_continue(instance, hist); break; case RESET: - ret = tracefs_hist_reset(hist); + ret = tracefs_hist_reset(instance, hist); break; case DELETE: - ret = tracefs_hist_destroy(hist); + ret = tracefs_hist_destroy(instance, hist); break; case SHOW: { char *content;
include/tracefs.h +8 -8
@@ -282,9 +282,9 @@ struct tracefs_hist;void tracefs_hist_free (struct tracefs_hist *hist);struct tracefs_hist * -tracefs_hist_alloc (struct tracefs_instance * instance, -const char *system,const char *event, -const char *key,enum tracefs_hist_key_type type); +tracefs_hist_alloc (struct tep_handle *tep, +const char *system,const char *event, +const char *key,enum tracefs_hist_key_type type);int tracefs_hist_add_key (struct tracefs_hist *hist,const char *key,enum tracefs_hist_key_type type);int tracefs_hist_add_value (struct tracefs_hist *hist,const char *value);
@@ -294,11 +294,11 @@ int tracefs_hist_sort_key_direction(struct tracefs_hist *hist,const char *sort_key, enum tracefs_hist_sort_direction dir);int tracefs_hist_add_name (struct tracefs_hist *hist,const char *name); -int tracefs_hist_start (struct tracefs_hist *hist); -int tracefs_hist_pause (struct tracefs_hist *hist); -int tracefs_hist_continue (struct tracefs_hist *hist); -int tracefs_hist_reset (struct tracefs_hist *hist); -int tracefs_hist_destroy (struct tracefs_hist *hist); +int tracefs_hist_start (struct tracefs_instance *instance,struct tracefs_hist *hist); +int tracefs_hist_pause (struct tracefs_instance *instance,struct tracefs_hist *hist); +int tracefs_hist_continue (struct tracefs_instance *instance,struct tracefs_hist *hist); +int tracefs_hist_reset (struct tracefs_instance *instance,struct tracefs_hist *hist); +int tracefs_hist_destroy (struct tracefs_instance *instance,struct tracefs_hist *hist);struct tracefs_synth ;
src/tracefs-hist.c +37 -31
179 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 2/7 libtracefs: Expose tracefs_hist_command() as an API
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
Expose trace_hist_start() as tracefs_hist_command() and make the following functions wrappers that call this function:
tracefs_hist_start()
tracefs_hist_pause()
tracefs_hist_reset()
tracefs_hist_destroy()
Exposing the enum for the above commands can make it easier for applications to run them depending on the input from the user.
--- Documentation/libtracefs-hist.txt | 20 ++++++ include/tracefs.h | 93 ++++++++++++++++++++++++-- src/tracefs-hist.c | 104 ++++-------------------------- 3 files changed, 120 insertions(+), 97 deletions(-)
Documentation/libtracefs-hist.txt +20 -0
@@ -25,6 +25,9 @@ int tracefs_hist_sort_key_direction(struct tracefs_hist pass:[*]hist, const char pass:[*]sort_key, enum tracefs_hist_sort_direction dir); int tracefs_hist_add_name(struct tracefs_hist pass:[*]hist, const char pass:[*]name); +int tracefs_hist_command(struct tracefs_instance pass:[*]instance, + struct tracefs_hist pass:[*]hist, + enum tracefs_hist_command command); int tracefs_hist_start(struct tracefs_instance pass:[*]instance, struct tracefs_hist pass:[*]hist); int tracefs_hist_destory(struct tracefs_instance pass:[*]instance, struct tracefs_hist pass:[*]hist); --
@@ -81,6 +84,23 @@ compatible keys, the multiple histograms with the same name will be merged into a single histogram (shown by either event's hist file). The _hist_ is the histogram to name, and the _name_ is the name to give it. +*tracefs_hist_command*() is called to process a command on the histogram +_hist_ for its event in the given _instance_, or NULL for the top level. +The _cmd_ can be one of: + +*TRACEFS_HIST_CMD_START* or zero to start execution of the histogram. + +*TRACEFS_HIST_CMD_PAUSE* to pause the given histogram. + +*TRACEFS_HIST_CMD_CONT* to continue a paused histogram. + +*TRACEFS_HIST_CMD_CLEAR* to reset the values of a histogram. + +*TRACEFS_HIST_CMD_DESTROY* to destroy the histogram (undo a START). + +The below functions are wrappers to tracefs_hist_command() to make the +calling conventions a bit easier to understand what is happening. + *tracefs_hist_start* is called to actually start the histogram _hist_. The _instance_ is the instance to start the histogram in, NULL if it should start at the top level.
include/tracefs.h +88 -5
105 lines not on this page · raw message
src/tracefs-hist.c +12 -92
139 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 3/7 libtracefs: Add API tracefs_hist_append_filter()
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
Add an API that will append a filter to the histogram just like filters can be added to the synthetic event's start and end events.
--- Documentation/libtracefs-hist.txt | 37 +++++++++++++++++++++++++ include/tracefs.h | 45 +++++++++++++++++-------------- src/tracefs-hist.c | 14 ++++++++++ 3 files changed, 76 insertions(+), 20 deletions(-)
Documentation/libtracefs-hist.txt +37 -0
@@ -25,6 +25,11 @@ int tracefs_hist_sort_key_direction(struct tracefs_hist pass:[*]hist, const char pass:[*]sort_key, enum tracefs_hist_sort_direction dir); int tracefs_hist_add_name(struct tracefs_hist pass:[*]hist, const char pass:[*]name); +int tracefs_hist_append_filter(struct tracefs_hist pass:[*]hist, + enum tracefs_filter type, + const char pass:[*]field, + enum tracefs_compare compare, + const char pass:[*]val); int tracefs_hist_command(struct tracefs_instance pass:[*]instance, struct tracefs_hist pass:[*]hist, enum tracefs_hist_command command);
@@ -84,6 +89,38 @@ compatible keys, the multiple histograms with the same name will be merged into a single histogram (shown by either event's hist file). The _hist_ is the histogram to name, and the _name_ is the name to give it. +*tracefs_hist_append_filter*() creates a filter or appends to it for the +histogram event. Depending on _type_, it will build a string of tokens for +parenthesis or logic statemens, or it may add a comparison of _field_ +to _val_ based on _compare_. + +If _type_ is: +*TRACEFS_FILTER_COMPARE* - See below +*TRACEFS_FILTER_AND* - Append "&&" to the filter +*TRACEFS_FILTER_OR* - Append "||" to the filter +*TRACEFS_FILTER_NOT* - Append "!" to the filter +*TRACEFS_FILTER_OPEN_PAREN* - Append "(" to the filter +*TRACEFS_FILTER_CLOSE_PAREN* - Append ")" to the filter + +_field_, _compare_, and _val_ are ignored unless _type_ is equal to +*TRACEFS_FILTER_COMPARE*, then _compare will be used for the following: + +*TRACEFS_COMPARE_EQ* - _field_ == _val_ + +*TRACEFS_COMPARE_NE* - _field_ != _val_ + +*TRACEFS_COMPARE_GT* - _field_ > _val_ + +*TRACEFS_COMPARE_GE* - _field_ >= _val_ + +*TRACEFS_COMPARE_LT* - _field_ < _val_ + +*TRACEFS_COMPARE_LE* - _field_ <pass:[=] _val_ + +*TRACEFS_COMPARE_RE* - _field_ ~ "_val_" : where _field_ is a string. + +*TRACEFS_COMPARE_AND* - _field_ & _val_ : where _field_ is a flags field. + *tracefs_hist_command*() is called to process a command on the histogram _hist_ for its event in the given _instance_, or NULL for the top level. The _cmd_ can be one of:
include/tracefs.h +25 -20
63 lines not on this page · raw message
src/tracefs-hist.c +14 -0
@@ -33,6 +33,8 @@ struct tracefs_hist {char **sort;char *filter;int size; +unsigned int filter_parens; +unsigned int filter_state; }; static void add_list(struct trace_seq *seq, const char *start,
@@ -454,6 +456,18 @@ int tracefs_hist_sort_key_direction(struct tracefs_hist *hist,return 0 ; } +int tracefs_hist_append_filter (struct tracefs_hist *hist, +enum tracefs_filter type, +const char *field, +enum tracefs_compare compare, +const char *val) +{ +return trace_append_filter (&hist->filter, &hist->filter_state, + &hist->filter_parens, + hist->event, + type, field, compare, val); +} +/* * @name: name of the synthetic event * @start_system: system of the starting event
Signature · 1 line
2.30.2
PATCH v2 4/7 libtracefs: Add API tracefs_hist_show()
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
Add tracefs_hist_show() that will display the commands that would be executed in order to create the given histogram.
--- Documentation/libtracefs-hist.txt | 8 +++ include/tracefs.h | 2 + src/tracefs-hist.c | 102 ++++++++++++++++++++++-------- 3 files changed, 85 insertions(+), 27 deletions(-)
Documentation/libtracefs-hist.txt +8 -0
@@ -30,6 +30,9 @@ int tracefs_hist_append_filter(struct tracefs_hist pass:[*]hist, const char pass:[*]field, enum tracefs_compare compare, const char pass:[*]val); +int tracefs_hist_show(struct trace_seq pass:[*]s, struct tracefs_instance pass:[*]instance, + struct tracefs_hist pass:[*]hist, + enum tracefs_hist_command command); int tracefs_hist_command(struct tracefs_instance pass:[*]instance, struct tracefs_hist pass:[*]hist, enum tracefs_hist_command command);
@@ -121,6 +124,11 @@ _field_, _compare_, and _val_ are ignored unless _type_ is equal to *TRACEFS_COMPARE_AND* - _field_ & _val_ : where _field_ is a flags field. +*trace_hist_show*() prints the commands needed to create the given histogram +in the given _instance_, or NULL for the top level, into the _seq_. +The command that is printed is described by _command_ and shows the functionality +that would be done by *tracefs_hist_command*(3). + *tracefs_hist_command*() is called to process a command on the histogram _hist_ for its event in the given _instance_, or NULL for the top level. The _cmd_ can be one of:
include/tracefs.h +2 -0
@@ -327,6 +327,8 @@ int tracefs_hist_append_filter(struct tracefs_hist *hist,const char *field, enum tracefs_compare compare, const char *val); +int tracefs_hist_show (struct trace_seq *seq,struct tracefs_instance *instance, +struct tracefs_hist *hist,enum tracefs_hist_command command);int tracefs_hist_command (struct tracefs_instance *instance,struct tracefs_hist *hist,enum tracefs_hist_command cmd);
src/tracefs-hist.c +75 -27
115 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 5/7 libtracefs: Split up libtracefs-synth man page
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
The man page for the synthetic event functions has more than 9, which causes errors when creating them. Create a libtracefs-synth2.txt file and move the descriptions of tracefs_synth_create(), tracefs_synth_destroy() and tracefs_synth_show() to it.
--- Documentation/libtracefs-synth.txt | 31 +--- Documentation/libtracefs-synth2.txt | 239 ++++++++++++++++++++++++++++ 2 files changed, 246 insertions(+), 24 deletions(-) create mode 100644 Documentation/libtracefs-synth2.txt
Documentation/libtracefs-synth.txt +7 -24
@@ -4,8 +4,8 @@ libtracefs(3) NAME ---- tracefs_synth_init, tracefs_synth_add_match_field, tracefs_synth_add_compare_field, tracefs_synth_add_start_field, -tracefs_synth_add_end_field, tracefs_synth_append_start_filter, tracefs_synth_append_end_filter, tracefs_synth_create, -tracefs_synth_destroy, tracefs_synth_free, tracefs_synth_show - Creation of synthetic events +tracefs_synth_add_end_field, tracefs_synth_append_start_filter, tracefs_synth_append_end_filter, tracefs_synth_free, +- Creation of a synthetic event descriptor SYNOPSIS --------
@@ -47,14 +47,7 @@ int tracefs_synth_append_end_filter(struct tracefs_synth pass:[*]synth, const char pass:[*]field, enum tracefs_synth_compare compare, const char pass:[*]val); -int tracefs_synth_create(struct tracefs_instance pass:[*]instance, - struct tracefs_synth pass:[*]synth); -int tracefs_synth_destroy(struct tracefs_instance pass:[*]instance, - struct tracefs_synth pass:[*]synth); -void tracefs_synth_free(struct tracefs_synth pass:[*]synth); -int tracefs_synth_show(struct trace_seq pass:[*]seq, struct tracefs_instance pass:[*]instance, - struct tracefs_synth pass:[*]synth); - +-void tracefs_synth_free(struct tracefs_synth pass:[*]synth); -- DESCRIPTION
@@ -78,7 +71,7 @@ delta in microseconds. This is used as the example below. *tracefs_synth_init*() allocates and initializes a synthetic event. It does not create the synthetic event, but supplies the minimal information -to do so. See *tracefs_synth_create*() below for how to create the synthetic +to do so. See *tracefs_synth_create*(3) for how to create the synthetic event in the system. It requires a _tep_ handler that can be created by *tracefs_local_events*(3) for more information. The _name_ holds the name of the synthetic event that will be created. The _start_system is the name
@@ -162,22 +155,9 @@ _field_, _compare_, and _val_ are ignored unless _type_ is equal to *tracefs_synth_append_end_filter*() is the same as *tracefs_synth_append_start_filter* but filters on the ending event. -*tracefs_synth_create*() creates the synthetic event in the system in the system -in the _instance_ provided. Note, synthetic events apply across all instances, -but some creation requires histograms to be established, which are local to -instances. - -*tracefs_synth_destroy*() destroys the synthetic event. It will attempt to stop -the running of it in the given _instance_, but if its running in another instance -this may fail as busy. - *tracefs_synth_free*() frees the allocated descriptor returned by *tracefs_synth_init*(). -*tracefs_synth_show*() acts like *tracefs_synth_create*(), but instead of creating -the synthetic event in the given _instance_, it will write the echo commands to -manually create it in the _seq_ given. - RETURN VALUE ------------ *tracefs_synth_init*() returns an allocated struct tracefs_synth descriptor
@@ -330,6 +310,9 @@ FILES SEE ALSO -------- +_tracefs_synth_create_(3), +_tracefs_synth_destroy_(3), +_tracfes_synth_show_(3), _libtracefs(3)_, _libtraceevent(3)_, _trace-cmd(1)_,
Documentation/libtracefs-synth2.txt new file +239 -0
239 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 6/7 libtracefs: Add API tracefs_synth_get_start_hist()
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
Add the API tracefs_synth_get_start_hist() that returns a tracefs_hist descriptor describing the start event of a tracefs_synth.
--- Documentation/libtracefs-synth2.txt | 4 ++ include/tracefs.h | 1 + src/tracefs-hist.c | 73 +++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+)
Documentation/libtracefs-synth2.txt +4 -0
@@ -17,6 +17,7 @@ int tracefs_synth_destroy(struct tracefs_instance pass:[*]instance, struct tracefs_synth pass:[*]synth); int tracefs_synth_show(struct trace_seq pass:[*]seq, struct tracefs_instance pass:[*]instance, struct tracefs_synth pass:[*]synth); +struct tracefs_hist pass:[*]tracefs_synth_get_start_hist(struct tracefs_synth pass:[*]synth); --
@@ -52,6 +53,9 @@ this may fail as busy. the synthetic event in the given _instance_, it will write the echo commands to manually create it in the _seq_ given. +*tracefs_synth_get_start_hist*() returns a struct tracefs_hist descriptor describing +the histogram used to create the synthetic event. + RETURN VALUE ------------ Returns zero on success or -1 on error.
include/tracefs.h +1 -0
@@ -467,6 +467,7 @@ int tracefs_synth_append_end_filter(struct tracefs_synth *synth,const char *field, enum tracefs_compare compare, const char *val); +struct tracefs_hist *tracefs_synth_get_start_hist (struct tracefs_synth *synth);int tracefs_synth_create (struct tracefs_instance *instance,struct tracefs_synth *synth); int tracefs_synth_destroy(struct tracefs_instance *instance,
src/tracefs-hist.c +73 -0
98 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 7/7 libtracefs: Add API tracefs_synth_complete()
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
Add tracefs_synth_complete() to tell if the synthetic event is a full synthetic event (can create a synthetic event) or not, where it has only enough information to create the starting histogram.
--- Documentation/libtracefs-synth2.txt | 4 ++++ include/tracefs.h | 1 + src/tracefs-hist.c | 13 +++++++++++++ 3 files changed, 18 insertions(+)
Documentation/libtracefs-synth2.txt +4 -0
@@ -17,6 +17,7 @@ int tracefs_synth_destroy(struct tracefs_instance pass:[*]instance, struct tracefs_synth pass:[*]synth); int tracefs_synth_show(struct trace_seq pass:[*]seq, struct tracefs_instance pass:[*]instance, struct tracefs_synth pass:[*]synth); +bool tracefs_synth_complete(struct tracefs_synth pass:[*]synth); struct tracefs_hist pass:[*]tracefs_synth_get_start_hist(struct tracefs_synth pass:[*]synth); --
@@ -53,6 +54,9 @@ this may fail as busy. the synthetic event in the given _instance_, it will write the echo commands to manually create it in the _seq_ given. +*tracefs_synth_complete*() returns true if the synthetic event _synth_ has both +a starting and ending event. + *tracefs_synth_get_start_hist*() returns a struct tracefs_hist descriptor describing the histogram used to create the synthetic event.
include/tracefs.h +1 -0
@@ -467,6 +467,7 @@ int tracefs_synth_append_end_filter(struct tracefs_synth *synth,const char *field, enum tracefs_compare compare, const char *val); +bool tracefs_synth_complete (struct tracefs_synth *synth);struct tracefs_hist *tracefs_synth_get_start_hist (struct tracefs_synth *synth);int tracefs_synth_create (struct tracefs_instance *instance,struct tracefs_synth *synth);
src/tracefs-hist.c +13 -0
@@ -1354,6 +1354,19 @@ static int verify_state(struct tracefs_synth *synth)return 0 ; } +/** +* tracefs_synth_complete - tell if the tracefs_synth is complete or not +* @synth: The synthetic event to get the start hist from. +* +* Retruns true if the synthetic event @synth has both a start and +* end event (ie. a synthetic event, or just a histogram), and +* false otherwise. +*/ +bool tracefs_synth_complete (struct tracefs_synth *synth) +{ +return synth && synth->start_event && synth->end_event; +} +/** * tracefs_synth_get_start_hist - Return the histogram of the start event * @synth: The synthetic event to get the start hist from.
Signature · 1 line
2.30.2