Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:trace_array_create

Proto:static struct trace_array *trace_array_create(const char *name)

Type:struct trace_array

Parameter:

TypeParameterName
const char *name
8473  ret = -ENOMEM
8474  tr = 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).
8475  If Not tr Then Return ERR_PTR(ret)
8478  name = kstrdup(name, GFP_KERNEL)
8479  If Not name Then Go to out_free_tr
8482  If Not alloc_cpumask_var( & only trace on set CPUs , GFP_KERNEL) Then Go to out_free_tr
8485  trace_flags = trace_flags & ~race_flags that are default zero for instances
8487  pumask_copy - *dstp = *srcp*@dstp: the result*@srcp: the input cpumask
8489  raw_spin_lock_init( & start_lock)
8491  * max_lock is used to protect the swapping of buffers * when taking a max snapshot. The buffers themselves are * protected by per_cpu spinlocks. But the action of the swap * needs its own lock. * This is defined as a arch_spinlock_t in order to help * with = (arch_spinlock_t)
8493  current_trace = nop_trace
8495  Initialization list head
8496  Initialization list head
8497  Initialization list head
8498  Initialization list head
8500  If allocate_trace_buffers(tr, trace_buf_size) < 0 Then Go to out_free_tr
8503  dir = tracefs_create_dir(name, trace_instance_dir)
8504  If Not dir Then Go to out_free_tr
8507  ret = vent_trace_add_tracer - add a instance of a trace_array to events*@parent: The parent dentry to place the files/directories for events in*@tr: The trace array associated with these events* When a new instance is created, it needs to set up its events
8508  If ret Then
8509  tracefs_remove_recursive(dir)
8510  Go to out_free_tr
8513  ftrace_init_trace_array(tr)
8515  init_tracer_tracefs(tr, dir)
8516  init_trace_flags_index(tr)
8517  __update_tracer_options(tr)
8519  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
8521  ref++
8524  Return tr
8526  out_free_tr :
8527  free_trace_buffers(tr)
8528  free_cpumask_var( only trace on set CPUs )
8529  kfree(name)
8530  kfree(tr)
8532  Return ERR_PTR(ret)
Caller
NameDescribe
instance_mkdir
trace_array_get_by_namerace_array_get_by_name - Create/Lookup a trace array, given its name