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

Name:reate_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)*

Proto:static struct hist_field *create_field_var_hist(struct hist_trigger_data *target_hist_data, char *subsys_name, char *event_name, char *field_name)

Type:struct hist_field

Parameter:

TypeParameterName
struct hist_trigger_data *target_hist_data
char *subsys_name
char *event_name
char *field_name
3289  tr = tr
3290  event_var = ERR_PTR( - EINVAL)
3292  unsigned int i, n, first = true
3300  If n_field_var_hists >= SYNTH_FIELDS_MAX Then
3301  hist_err(tr, HIST_ERR_TOO_MANY_FIELD_VARS, errpos(field_name))
3302  Return ERR_PTR( - EINVAL)
3305  file = event_file(tr, subsys_name, event_name)
3307  If IS_ERR(file) Then
3308  hist_err(tr, HIST_ERR_EVENT_FILE_NOT_FOUND, errpos(field_name))
3309  ret = PTR_ERR(file)
3310  Return ERR_PTR(ret)
3319  hist_data = find_compatible_hist(target_hist_data, file)
3320  If Not hist_data Then
3321  hist_err(tr, HIST_ERR_HIST_NOT_FOUND, errpos(field_name))
3322  Return ERR_PTR( - EINVAL)
3326  event_var = find_synthetic_field_var(target_hist_data, subsys_name, event_name, field_name)
3328  If Not IS_ERR_OR_NULL(event_var) Then Return event_var
3331  var_hist = 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).
3332  If Not var_hist Then Return ERR_PTR( - ENOMEM)
3335  cmd = 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).
3336  If Not cmd Then
3337  kfree(var_hist)
3338  Return ERR_PTR( - ENOMEM)
3342  strcat(cmd, "keys=")
3345  key_field = fields[i]
3346  If Not first Then strcat(cmd, ",")
3348  strcat(cmd, name)
3349  first = false
3353  strcat(cmd, ":synthetic_")
3354  strcat(cmd, field_name)
3355  strcat(cmd, "=")
3356  strcat(cmd, field_name)
3359  saved_filter = find_trigger_filter(hist_data, file)
3360  If saved_filter Then
3361  strcat(cmd, " if ")
3362  strcat(cmd, saved_filter)
3365  cmd = kstrdup(cmd, GFP_KERNEL)
3366  If Not cmd Then
3367  kfree(cmd)
3368  kfree(var_hist)
3369  Return ERR_PTR( - ENOMEM)
3373  hist_data = hist_data
3376  ret = event_hist_trigger_func( & trigger_hist_cmd, file, "", "hist", cmd)
3378  If ret Then
3379  kfree(cmd)
3380  kfree(cmd)
3381  kfree(var_hist)
3382  hist_err(tr, HIST_ERR_HIST_CREATE_FAIL, errpos(field_name))
3383  Return ERR_PTR(ret)
3386  kfree(cmd)
3389  event_var = find_synthetic_field_var(target_hist_data, subsys_name, event_name, field_name)
3391  If IS_ERR_OR_NULL(event_var) Then
3392  kfree(cmd)
3393  kfree(var_hist)
3394  hist_err(tr, HIST_ERR_SYNTH_VAR_NOT_FOUND, errpos(field_name))
3395  Return ERR_PTR( - EINVAL)
3398  n = n_field_var_hists
3399  field_var_hists[n] = var_hist
3400  n_field_var_hists++
3402  Return event_var
Caller
NameDescribe
trace_action_create_field_var