sponsor Vim development Vim logo Vim Book Ad

gprof.vim : A file type plugin for gprof (GNU profiler) output

 script karma  Rating 8/6, Downloaded by 2510  Comments, bugs, improvements  Vim wiki

created by
Dominique Pellé
 
script type
ftplugin
 
description
This is a filetype plugin for gprof output files (GNU profiler). It provides a mapping to facilitate navigation in gprof files as well as syntax highlighting of gprof output.

Screencast demo: http://shelr.tv/records/4fb8d6739660807d3d00000a
Screenshot: http://dominique.pelle.free.fr/pic/ft_gprof.png

Gprof output files have no specific extension. To recognize the file type, you will need to explicitly set the file type with the Ex command ":set filetype gprof".  For example, to look at the gprof output when profiling Vim, you can use:

  $ gprof vim gmon.out | vim - -c 'setfiletype gprof'

Alternatively, you can also add the following lines into your $VIMRUNTIME/scripts.vim to automatically recognize the gprof file type when reading from stdin: >

   " Gprof (gnu profiler)
   elseif s:line1 == 'Flat profile:'
   \   && s:line2 == ''
   \   && s:line3 =~ '^Each sample counts as .* seconds.$'
     set ft=gprof

Vim should then figure the gprof file type automatically when using:

  $ gprof vim gmon.out | vim -

Gprof output contains a flat profile section and a call graph section. Analyzing the output of gprof often requires jumping back in forth in the gprof output. This can be cumbersome. The plugin makes it easier. When the cursor is located in a line in the gprof flat profile or in a line in the call graph, pressing CTRL-] jumps to the corresponding function in the call graph. The jump is remembered in the jumplist so pressing CTRL-I jumps back to the position prior to pressing CTRL-].

For further information about the GNU profiler, see:

  ftp://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html
 
install details
Install the plugin with:

  $ mkdir ~/.vim
  $ cd ~/.vim
  $ unzip /path-to/ft_gprof.zip
  $ vim -c 'helptags ~/.vim/doc'
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
ft_gprof.zip 0.4 2012-05-20 6.0 Dominique Pellé - added link to screencast demo http://shelr.tv/records/4fb8d6739660807d3d00000a
ft_gprof.zip 0.3 2012-05-20 6.0 Dominique Pellé - huge speed up of syntax highlighting
- fixes for syntax highlighting
- fixed error when loading 2 gprof files
ft_gprof.zip 0.2 2012-05-19 6.0 Dominique Pellé - fixes for c++: function names can contain * [ ] . which messed up pattern matching when pressing CTRL-]
- fixes in syntax highlighting
- jumplist now works as expected (can press CTRL-I after CTRL-])
ft_gprof.zip 0.1 2012-05-19 6.0 Dominique Pellé Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github