blob: d2c5cb4cabd46a530f81ddd8bf991bef9786cdd2 [file] [log] [blame]
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001" Vim syntax file
2" Language: Syntax for Gprof Output
3" Maintainer: Dominique Pelle <dominique.pelle@gmail.com>
Bram Moolenaar34cc7d82021-09-21 20:09:51 +02004" Last Change: 2021 Sep 19
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02005
6" Quit when a syntax file was already loaded
7if exists("b:current_syntax")
Bram Moolenaar34cc7d82021-09-21 20:09:51 +02008 finish
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02009endif
10let s:keepcpo= &cpo
11set cpo&vim
12
Bram Moolenaar34cc7d82021-09-21 20:09:51 +020013syn spell notoplevel
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020014syn 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$"
Bram Moolenaar56994d22021-04-17 16:31:09 +020032syn match gprofCallGraphFunction "\<\(\d\+\.\d\+\s\+\)\{3}\([0-9+]\+\)\?\s\+[a-zA-Z_<].*\ze\["
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020033syn match gprofCallGraphSeparator "^-\+$"
34syn region gprofCallGraphTrailer
35 \ start="This table describes the call tree of the program"
Bram Moolenaarec7944a2013-06-12 21:29:15 +020036 \ end="^\s*the cycle\.$"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020037
38" Index
39syn region gprofIndex
40 \ start="^Index by function name$"
41 \ end="\%$"
42
43syn match gprofIndexFunctionTitle "^Index by function name$"
44
Bram Moolenaar56994d22021-04-17 16:31:09 +020045syn match gprofNumbers "^\s*[0-9 ./+]\+"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020046syn 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