neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

gprof.vim (2136B)


      1 " Vim syntax file
      2 " Language: Syntax for Gprof Output
      3 " Maintainer: Dominique Pelle <dominique.pelle@gmail.com>
      4 " Last Change: 2021 Sep 19
      5 
      6 " Quit when a syntax file was already loaded
      7 if exists("b:current_syntax")
      8  finish
      9 endif
     10 let s:keepcpo= &cpo
     11 set cpo&vim
     12 
     13 syn spell notoplevel
     14 syn case match
     15 syn sync minlines=100
     16 
     17 " Flat profile
     18 syn match gprofFlatProfileTitle
     19  \ "^Flat profile:$" 
     20 syn region gprofFlatProfileHeader 
     21  \ start="^Each sample counts as.*"
     22  \ end="^ time.*name\s*$"
     23 syn region gprofFlatProfileTrailer
     24  \ start="^\s*%\s\+the percentage of the total running time.*"
     25  \ end="^\s*the gprof listing if it were to be printed\."
     26 
     27 " Call graph
     28 syn match gprofCallGraphTitle "Call graph (explanation follows)"
     29 syn region gprofCallGraphHeader
     30  \ start="^granularity: each sample hit covers.*"
     31  \ end="^\s*index % time\s\+self\s\+children\s\+called\s\+name$"
     32 syn match gprofCallGraphFunction "\<\(\d\+\.\d\+\s\+\)\{3}\([0-9+]\+\)\?\s\+[a-zA-Z_<].*\ze\["
     33 syn match gprofCallGraphSeparator "^-\+$"
     34 syn region gprofCallGraphTrailer
     35  \ start="This table describes the call tree of the program"
     36  \ end="^\s*the cycle\.$"
     37 
     38 " Index
     39 syn region gprofIndex
     40  \ start="^Index by function name$"
     41  \ end="\%$"
     42 
     43 syn match gprofIndexFunctionTitle "^Index by function name$"
     44 
     45 syn match gprofNumbers "^\s*[0-9 ./+]\+"
     46 syn match gprofFunctionIndex "\[\d\+\]"
     47 syn match gprofSpecial "<\(spontaneous\|cycle \d\+\)>"
     48 
     49 hi def link gprofFlatProfileTitle      Title
     50 hi def link gprofFlatProfileHeader     Comment
     51 hi def link gprofFlatProfileFunction   Number
     52 hi def link gprofFlatProfileTrailer    Comment
     53 
     54 hi def link gprofCallGraphTitle        Title
     55 hi def link gprofCallGraphHeader       Comment
     56 hi def link gprofFlatProfileFunction   Number
     57 hi def link gprofCallGraphFunction     Special
     58 hi def link gprofCallGraphTrailer      Comment
     59 hi def link gprofCallGraphSeparator    Label
     60 
     61 hi def link gprofFunctionIndex         Label
     62 hi def link gprofSpecial               SpecialKey
     63 hi def link gprofNumbers               Number
     64 
     65 hi def link gprofIndexFunctionTitle Title
     66 
     67 let b:current_syntax = "gprof"
     68 
     69 let &cpo = s:keepcpo
     70 unlet s:keepcpo