gprof.vim 2.1 KB

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