1,583
edits
Changes
→Profiling
== Profiling ==
Here is an example of starting up a command-line function and profiling it:
<pre>
python /usr/lib/python2.6/cProfile.py -o profile-log src/gramps.py -i ~/Desktop/import-test.gramps
</pre>
This example will save the profile output into a file called '''profile-log''' which can then be analyzed using the Stats class (described below).
This can take quite a bit of time. Note: importing does not automatically exit gramps. You should immediately exit, so that the code of running the GUI does not effect the profile of the import.
=== Profile Analysis ===
To analyze a profile log you can:
>>> import pstats
>>> profile_stats = pstats.Stats('profile-log')
>>> profile_stats.sort_stats('cumulative').print_stats(10)
=== Profile Links ===
* [[Debugging_GRAMPS#Use_profiling]] - some notes on profiling GRAMPS