Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) " Enable folding for ftrace function_graph traces.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) " To use, :source this file while viewing a function_graph trace, or use vim's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) " -S option to load from the command-line together with a trace.  You can then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) " use the usual vim fold commands, such as "za", to open and close nested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) " functions.  While closed, a fold will show the total time taken for a call,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) " as would normally appear on the line with the closing brace.  Folded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) " functions will not include finish_task_switch(), so folding should remain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) " relatively sane even through a context switch.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) " Note that this will almost certainly only work well with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) " single-CPU trace (e.g. trace-cmd report --cpu 1).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) function! FunctionGraphFoldExpr(lnum)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)   let line = getline(a:lnum)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)   if line[-1:] == '{'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)     if line =~ 'finish_task_switch() {$'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)       return '>1'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)     endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)     return 'a1'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)   elseif line[-1:] == '}'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)     return 's1'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)   else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)     return '='
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)   endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) endfunction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) function! FunctionGraphFoldText()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)   let s = split(getline(v:foldstart), '|', 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)   if getline(v:foldend+1) =~ 'finish_task_switch() {$'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)     let s[2] = ' task switch  '
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)   else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)     let e = split(getline(v:foldend), '|', 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)     let s[2] = e[2]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)   endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)   return join(s, '|')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) endfunction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) setlocal foldexpr=FunctionGraphFoldExpr(v:lnum)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) setlocal foldtext=FunctionGraphFoldText()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) setlocal foldcolumn=12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) setlocal foldmethod=expr