Function report | 
Source Code:kernel\events\core.c | 
Create Date:2022-07-28 13:34:27 | 
| Last Modify:2022-05-20 07:50:19 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:Returns a matching context with refcount and pincount.
Proto:static struct perf_event_context *find_get_context(struct pmu *pmu, struct task_struct *task, struct perf_event *event)
Type:struct perf_event_context
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct pmu * | pmu | |
| struct task_struct * | task | |
| struct perf_event * | event | 
| 4269 | struct perf_event_context * ctx, * clone_ctx = NULL | 
| 4271 | void * task_ctx_data = NULL | 
| 4276 | If Not task Then | 
| 4278 | err = perf_allow_cpu( & attr) | 
| 4282 | cpuctx = per_cpu_ptr(pmu_cpu_context, cpu) | 
| 4285 | ++pin_count | 
| 4287 | Return ctx | 
| 4291 | ctxn = task_ctx_nr | 
| 4295 | If attach_state & PERF_ATTACH_TASK_DATA Then | 
| 4296 | task_ctx_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). | 
| 4297 | If Not task_ctx_data Then | 
| 4303 | retry : | 
| 4304 | ctx = Get the perf_event_context for a task and lock it.* This has to cope with with the fact that until it is locked,* the context could get moved to another task. | 
| 4305 | If ctx Then | 
| 4307 | ++pin_count | 
| 4309 | If task_ctx_data && Not pmu specific data Then | 
| 4310 | pmu specific data = task_ctx_data | 
| 4311 | task_ctx_data = NULL | 
| 4317 | Else | 
| 4318 | ctx = alloc_perf_context(pmu, task) | 
| 4323 | If task_ctx_data Then | 
| 4324 | pmu specific data = task_ctx_data | 
| 4325 | task_ctx_data = NULL | 
| 4328 | err = 0 | 
| 4329 | mutex_lock( & perf_event_mutex) | 
| 4334 | If Per task flags (PF_*), defined further below: & Getting shut down Then err = -ESRCH | 
| 4336 | Else if perf_event_ctxp[ctxn] Then err = -EAGAIN | 
| 4338 | Else | 
| 4340 | ++pin_count | 
| 4354 | kfree(task_ctx_data) | 
| 4355 | Return ctx | 
| 4357 | errout : | 
| 4358 | kfree(task_ctx_data) | 
| Name | Describe | 
|---|---|
| perf_event_create_kernel_counter | perf_event_create_kernel_counter*@attr: attributes of the counter to create*@cpu: cpu in which the counter is bound*@task: task to profile (NULL for percpu) | 
| Source code conversion tool public plug-in interface  | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion  |