From 43f1f878cab76a255db975600f6a41a1c6d683d8 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 31 Dec 2015 23:46:42 +0200 Subject: Add a section on running Obnam under a profiler --- manual/en/160-tuning.mdwn | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'manual/en') diff --git a/manual/en/160-tuning.mdwn b/manual/en/160-tuning.mdwn index 180a3389..160caab7 100644 --- a/manual/en/160-tuning.mdwn +++ b/manual/en/160-tuning.mdwn @@ -6,3 +6,42 @@ memory consumption, as well as ways to experiment to find a good set of values. See for a start. + + +## Running Obnam under the Python profiler + +A **profiler** is a program that measures where another program spends +its time. This can be very useful for finding out why the other +program is slow. + +Obnam can easily be run under the Python profiler. You need to have +the profiler installed. Check with your operating system or Python +installation how to achieve that. To see if you have it installed, run +the following command on the command line: + + python -c 'import cProfile' + +If this outputs nothing, all is well. If it outputs an error such as +the following, you have not got the profiler installed: + + Traceback (most recent call last): + File "", line 1, in + ImportError: No module named cProfiler + +Once you have the profiler installed, run Obnam like this: + + OBNAM_PROFILE=backup.prof obnam bsckup + +This will cause the profiling data to be written to the file +`backup.prof`. You can do this for any Obnam command, and write it to +any file. + +The profiling data is in binary form. Obnam comes with a little helper +program to transform it to a human-readable form: + + obnam-viewprof backup.prof | less + +If you run the above command, you'll see that the humans to whom this +is readable are programmers and circus clowns. If you can understand +the output, great! If not, it's still useful to send that to the Obnam +developers to report a performance problem. -- cgit v1.2.1