Difference between revisions of "Profiling"

From Inkscape Wiki
Jump to navigation Jump to search
Line 50: Line 50:


Then build clean Inkscape.
Then build clean Inkscape.
Running Inkscape will create a gmon.out file.
Then one can do:
    gprof inkscape.dbg gmon.out > report.txt


== Helpful Profiling Links ==
== Helpful Profiling Links ==

Revision as of 15:01, 16 June 2008

How to Profile (Linux)

Here is a description of how to profile under Linux from Bryce Harrington:

Here is how I've done profiling for Inkscape in the past. I have no idea if this will work on Win32 though since profiling requires kernel calls, so you may have to do some adapting.

There are essentially three major steps:

 A)  Compile the application with profiling support
 B)  Run the application in a "certain way"
 C)  Run gprof to generate analysis reports

For Step A what you need to do is add the -pg option to the compiler. You can do this via the CXXFLAGS variable at configure time. For example in Bash:

 $ CXXFLAGS='-pg' ./configure
 $ make

Step B is where some creativity is needed. You'll probably want to do several profiling runs to get the hang of it. Essentially, you want to exercise the part of the program you're most interested in measuring. For instance, if you're measuring the speed of rendering stars, you may want to create a document full of zillions of stars, and start Inkscape with that file, then immediately close when it finishes rendering.

As part of Step B, a special output file is generated (called gmon.out by default). In Step C, you run gprof on inkscape executable and this file to generate different sorts of reports, such as the flat profile and call graph. For example here's how to get the plain default report:

  $ gprof inkscape gmon.out > report

Read the report file for a table of functions sorted by how much time each function worked during this run of Inkscape. See the gprof manpage for all the analysis report options.

Bryce

How to Profile (Windows)

very incomplete, please add all you can.

Basically it works the same as on linux, although now you have to change things in build.xml. Add '-pg' to compiler and linker flags: Compiler:

   -mms-bitfields -pg

Linker

   -mconsole -pg

Then build clean Inkscape.

Running Inkscape will create a gmon.out file. Then one can do:

   gprof inkscape.dbg gmon.out > report.txt

Helpful Profiling Links