Function report | 
Source Code:kernel\events\ring_buffer.c | 
Create Date:2022-07-28 13:42:12 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:__perf_output_begin
Proto:static __always_inline int __perf_output_begin(struct perf_output_handle *handle, struct perf_event *event, unsigned int size, bool backward)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| 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 | 
| 170 | If Value for the false possibility is greater at compile time(!rb) Then Go to out | 
| 174 | If nr of data pages Then local_inc( & nr records lost ) | 
| 176 | Go to out | 
| 182 | have_lost = local_read( & nr records lost ) | 
| 184 | size += size of lost_event | 
| 185 | If sample_id_all Then size += id_header_size | 
| 191 | Do | 
| 192 | tail = READ_ONCE(user-space written tail ) | 
| 193 | offset = head = local_read( & write position ) | 
| 194 | If Not can overwrite itself Then | 
| 195 | If Value for the false possibility is greater at compile time(!ring_buffer_has_space(head, tail, perf_data_size(rb), size, backward)) Then Go to fail | 
| 217 | When local_cmpxchg( & write position , offset, head) != offset cycle | 
| 219 | If backward Then | 
| 229 | If Value for the false possibility is greater at compile time(head - local_read( & wakeup stamp ) > wakeup watermark ) Then 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 | 
| 242 | size = size of 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 | Return 0 | 
| 256 | fail : | 
| 257 | local_inc( & nr records lost ) | 
| 259 | out : | 
| 262 | Return -ENOSPC | 
| Name | Describe | 
|---|---|
| perf_output_begin_forward | |
| perf_output_begin_backward | |
| perf_output_begin | 
| 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  |