Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\trace_events_hist.c Create Date:2022-07-28 12:30:35
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:parse_field

Proto:static struct ftrace_event_field *parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, char *field_str, unsigned long *flags)

Type:struct ftrace_event_field

Parameter:

TypeParameterName
struct hist_trigger_data *hist_data
struct trace_event_file *file
char *field_str
unsigned long *flags
2801  struct ftrace_event_field * field = NULL
2803  tr = tr
2805  modifier = str = kstrdup(field_str, GFP_KERNEL)
2806  If Not modifier Then Return ERR_PTR( - ENOMEM)
2809  field_name = strsep - Split a string into tokens*@s: The string to be searched*@ct: The characters to search for* strsep() updates @s to point after the token, ready for the next call.* It returns empty tokens, too, behaving exactly like the libc function
2810  If modifier Then
2811  If strcmp(modifier, "hex") == 0 Then flags |= HIST_FIELD_FL_HEX
2813  Else if strcmp(modifier, "sym") == 0 Then flags |= HIST_FIELD_FL_SYM
2815  Else if strcmp(modifier, "sym-offset") == 0 Then flags |= HIST_FIELD_FL_SYM_OFFSET
2817  Else if strcmp(modifier, "execname") == 0 && strcmp(field_name, "common_pid") == 0 Then flags |= HIST_FIELD_FL_EXECNAME
2820  Else if strcmp(modifier, "syscall") == 0 Then flags |= HIST_FIELD_FL_SYSCALL
2822  Else if strcmp(modifier, "log2") == 0 Then flags |= HIST_FIELD_FL_LOG2
2824  Else if strcmp(modifier, "usecs") == 0 Then flags |= HIST_FIELD_FL_TIMESTAMP_USECS
2826  Else
2828  field = ERR_PTR( - EINVAL)
2829  Go to out
2833  If strcmp(field_name, "common_timestamp") == 0 Then
2834  flags |= HIST_FIELD_FL_TIMESTAMP
2835  enable_timestamps = true
2836  If flags & HIST_FIELD_FL_TIMESTAMP_USECS Then ts_in_usecs = true
2838  Else if strcmp(field_name, "cpu") == 0 Then flags |= HIST_FIELD_FL_CPU
2840  Else
2841  field = trace_find_event_field(event_call, field_name)
2842  If Not field || Not size Then
2844  field = ERR_PTR( - EINVAL)
2845  Go to out
2848  out :
2849  kfree(str)
2851  Return field
Caller
NameDescribe
parse_atom
parse_entryCaller is responsible to free the *pentry.