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