函数逻辑报告 | 
Source Code:kernel\events\core.c | 
Create Date:2022-07-27 15:02:18 | 
| Last Modify:2022-05-20 07:50:19 | Copyright©Brick | 
| 首页 | 函数Tree | 
| 注解内核,赢得工具 | 下载SCCT | English | 
函数名称:Initialize the perf_event context in task_struct
函数原型:static int perf_event_init_context(struct task_struct *child, int ctxn)
返回类型:int
参数:
| 类型 | 参数 | 名称 | 
|---|---|---|
| struct task_struct * | child | |
| int | ctxn | 
| 12265 | inherited_all等于1 | 
| 12267 | ret等于0 | 
| 12269 | 如果此条件成立可能性大(为编译器优化)(!perf_event_ctxp[ctxn])则返回:0 | 
| 12276 | parent_ctx等于Get the context for a task and increment its pin_count so it* can't get swapped to another task. This also increments its* reference count so that the context can't get freed. | 
| 12277 | 如果非parent_ctx则返回:0 | 
| 12291 | mutex_lock( & Protect the list of events. Locking either mutex or lock* is sufficient to ensure the list doesn't change; to change* the list you need to lock both the mutex and the spinlock.) | 
| 12300 | 如果ret则转到:out_unlock | 
| 12309 | raw_spin_lock_irqsave( & Protect the states of the events in the list,* nr_active, and the list:, flags) | 
| 12310 | rotate_disable等于1 | 
| 12311 | raw_spin_unlock_irqrestore( & Protect the states of the events in the list,* nr_active, and the list:, flags) | 
| 12316 | 如果ret则转到:out_unlock | 
| 12320 | raw_spin_lock_irqsave( & Protect the states of the events in the list,* nr_active, and the list:, flags) | 
| 12321 | rotate_disable等于0 | 
| 12323 | child_ctx等于perf_event_ctxp[ctxn] | 
| 12325 | 如果child_ctx且inherited_all则 | 
| 12333 | cloned_ctx等于These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor. | 
| 12334 | 如果cloned_ctx则 | 
| 12335 | These fields let us detect when two contexts have both* been cloned (inherited) from a common ancestor.等于cloned_ctx | 
| 12336 | parent_gen等于parent_gen | 
| 12337 | 否则 | 
| 12344 | raw_spin_unlock_irqrestore( & Protect the states of the events in the list,* nr_active, and the list:, flags) | 
| 12345 | out_unlock : | 
| 12348 | perf_unpin_context(parent_ctx) | 
| 12349 | put_ctx(parent_ctx) | 
| 12351 | 返回:ret | 
| 名称 | 描述 | 
|---|---|
| perf_event_init_task | 进程性能调优 | 
| 源代码转换工具 开放的插件接口  | X | 
|---|---|
| 支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码  |