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:34:11
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:event_hist_trigger_func

Proto:static int event_hist_trigger_func(struct event_command *cmd_ops, struct trace_event_file *file, char *glob, char *cmd, char *param)

Type:int

Parameter:

TypeParameterName
struct event_command *cmd_ops
struct trace_event_file *file
char *glob
char *cmd
char *param
6177  hist_trigger_bits = TRACING_MAP_BITS_DEFAULT
6184  bool remove = false
6186  ret = 0
6188  lockdep_assert_held( & event_mutex)
6190  If glob && strlen - Find the length of a string*@s: The string to be sized Then
6191  hist_err_clear()
6192  last_cmd_set(file, param)
6195  If Not param Then Return -EINVAL
6198  If glob[0] == '!' Then remove = true
6205  p = trigger = param
6206  Do
6207  p = strstr - Find the first substring in a %NUL terminated string*@s1: The string to be searched*@s2: The string to search for
6208  If Not p Then Break
6210  If p == param Then Return -EINVAL
6212  If *(p - 1) != ' ' && *(p - 1) != '\t' Then
6213  p++
6214  Continue
6216  If p >= param + strlen - Find the length of a string*@s: The string to be sized - size of "if" - 1 - 1 Then Return -EINVAL
6218  If *( p + size of "if" - 1) != ' ' && *( p + size of "if" - 1) != '\t' Then
6219  p++
6220  Continue
6222  Break
6223  When p cycle
6225  If Not p Then param = NULL
6227  Else
6228  *(p - 1) = '\0'
6229  param = strstrip(p)
6230  trigger = strstrip(trigger)
6233  attrs = parse_hist_trigger_attrs(tr, trigger)
6234  If IS_ERR(attrs) Then Return PTR_ERR(attrs)
6237  If map_bits Then hist_trigger_bits = map_bits
6240  hist_data = create_hist_data(hist_trigger_bits, attrs, file, remove)
6241  If IS_ERR(hist_data) Then
6242  destroy_hist_trigger_attrs(attrs)
6243  Return PTR_ERR(hist_data)
6246  trigger_ops = get_trigger_ops(cmd, trigger)
6248  trigger_data = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
6249  If Not trigger_data Then
6250  ret = -ENOMEM
6251  Go to out_free
6254  count = -1
6255  ops = trigger_ops
6256  cmd_ops = cmd_ops
6258  Initialization list head
6259  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers(filter, NULL)
6261  private_data = hist_data
6264  If param && set_filter Then
6265  ret = set_filter(param, trigger_data, file)
6266  If ret < 0 Then Go to out_free
6270  If remove Then
6271  If Not have_hist_trigger_match(trigger_data, file) Then Go to out_free
6275  ret = -EBUSY
6276  Go to out_free
6279  unreg(glob + 1, trigger_ops, trigger_data, file)
6280  se_name = trace_event_name(event_call)
6281  se = find_synth_event(se_name)
6282  If se Then ref--
6284  ret = 0
6285  Go to out_free
6288  ret = reg(glob, trigger_ops, trigger_data, file)
6294  If Not ret Then
6295  If Not ( pause || cont || clear) Then ret = -ENOENT
6297  Go to out_free
6298  Else if ret < 0 Then Go to out_free
6301  If get_named_trigger_data(trigger_data) Then Go to enable
6304  If has_hist_vars(hist_data) Then save_hist_vars(hist_data)
6307  ret = create_actions(hist_data)
6308  If ret Then Go to out_unreg
6311  ret = racing_map_init - Allocate and clear a map's tracing_map_elts*@map: The tracing_map to initialize* Allocates a clears a pool of tracing_map_elts equal to the* user-specified size of 2 ** map_bits (internally maintained as
6312  If ret Then Go to out_unreg
6314  enable :
6315  ret = hist_trigger_enable(trigger_data, file)
6316  If ret Then Go to out_unreg
6319  se_name = trace_event_name(event_call)
6320  se = find_synth_event(se_name)
6321  If se Then ref++
6324  ret = 0
6325  out :
6326  If ret == 0 Then hist_err_clear()
6329  Return ret
6330  out_unreg :
6331  unreg(glob + 1, trigger_ops, trigger_data, file)
6332  out_free :
6333  If set_filter Then set_filter(NULL, trigger_data, NULL)
6336  remove_hist_vars(hist_data)
6338  kfree(trigger_data)
6340  destroy_hist_data(hist_data)
6341  Go to out
Caller
NameDescribe
create_field_var_histreate_field_var_hist - Automatically create a histogram and var for a field*@target_hist_data: The target hist trigger*@subsys_name: Optional subsystem name*@event_name: Optional event name*@field_name: The name of the field (and the resulting variable)*
unregister_field_var_hists