trace: Add trace events group implementation in the backend "stderr"
PATCH v2 4/6 trace: Add trace events group implementation in the backend "stderr"
Signed-off-by Mark Wu <[email protected]>
--- trace/stderr.c | 32 ++++++++++++++++++++++++++++++++ trace/stderr.h | 7 +++++++ 2 files changed, 39 insertions(+), 0 deletions(-)
trace/stderr.c +32 -0
@@ -12,6 +12,17 @@ void trace_print_events(FILE *stream, fprintf_function stream_printf) } } +void trace_print_groups (FILE *stream,fprintf_function stream_printf) +{ +unsigned int i; + +for (i =0 ; i <NR_TRACE_EVENT_GROUPS ; i++) { +stream_printf (stream,"%s [GROUP ID %u] : state %u\n" , + trace_group_list[i].gp_name, i, + trace_group_list[i].state); + } +} +bool trace_event_set_state (const char *name,bool state) {unsigned int i;
@@ -25,6 +36,27 @@ bool trace_event_set_state(const char *name, bool state)return false; } +bool trace_event_group_set_state (const char *gp_name,bool state) +{ +unsigned int i; +unsigned int j; +TraceEventGroup *group; + +for (i =0 ; i <NR_TRACE_EVENT_GROUPS ; i++) { + + group = &trace_group_list[i]; +if (!strcmp (group->gp_name, gp_name)) { + group->state = state; + +for (j = group->start; j <= group->end; j++) { + trace_list[j].state = state; + } +return true; + } + } +return false; +} +bool trace_backend_init (const char *events,const char *file) {if (file) {
trace/stderr.h +7 -0
@@ -8,4 +8,11 @@ typedef struct { bool state; } TraceEvent; +typedef struct { +const char *gp_name; +bool state; +int start; +int end; +}TraceEventGroup ; +#endif /* ! TRACE_STDERR_H */
Signature · 1 line
1.7.1