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