函数逻辑报告 |
Source Code:kernel\events\ring_buffer.c |
Create Date:2022-07-27 15:02:56 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:__perf_output_begin
函数原型:static __always_inline int __perf_output_begin(struct perf_output_handle *handle, struct perf_event *event, unsigned int size, bool backward)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct perf_output_handle * | handle | |
struct perf_event * | event | |
unsigned int | size | |
bool | backward |
156 | struct{struct perf_event_header header;u64 id;u64 lost;}lost_event |
169 | rb等于cu_dereference() - fetch RCU-protected pointer for dereferencing*@p: The pointer to read, prior to dereferencing* This is a simple wrapper around rcu_dereference_check().(rb) |
170 | 如果此条件成立可能性小(为编译器优化)(!rb)则转到:out |
173 | 如果此条件成立可能性小(为编译器优化)( can write into ring buffer )则 |
174 | 如果 nr of data pages 则local_inc( & nr records lost ) |
176 | 转到:out |
182 | have_lost等于local_read( & nr records lost ) |
183 | 如果此条件成立可能性小(为编译器优化)(have_lost)则 |
184 | size加等于lost_event的长度 |
185 | 如果sample_id_all则size加等于id_header_size |
191 | 循环 |
192 | tail等于READ_ONCE(user-space written tail ) |
193 | offset等于head等于local_read( & write position ) |
194 | 如果非 can overwrite itself 则 |
195 | 如果此条件成立可能性小(为编译器优化)(!ring_buffer_has_space(head, tail, perf_data_size(rb), size, backward))则转到:fail |
217 | 当local_cmpxchg( & write position , offset, head)不等于offset循环 |
219 | 如果backward则 |
229 | 如果此条件成立可能性小(为编译器优化)(head - local_read( & wakeup stamp ) > wakeup watermark )则local_add( wakeup watermark , & wakeup stamp ) |
234 | page等于offset右移page_shift位按位与 nr of data pages 减1 |
235 | offset与等于1UL左移page_shift位的值减1 |
236 | addr等于data_pages[page]加offset |
237 | size等于1UL左移page_shift位的值减offset |
239 | 如果此条件成立可能性小(为编译器优化)(have_lost)则 |
242 | size等于lost_event的长度 |
243 | type等于PERF_RECORD_LOST |
244 | misc等于0 |
246 | lost等于Always has a lock prefix ( & nr records lost , 0) |
248 | perf_event_header__init_id( & header, & sample_data, event) |
250 | perf_output_put(handle, lost_event) |
254 | 返回:0 |
256 | fail : |
257 | local_inc( & nr records lost ) |
259 | out : |
262 | 返回:负ENOSPC |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |