diff options
| author | Glenn Morris | 2012-11-20 00:02:54 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-11-20 00:02:54 -0800 |
| commit | 5b776637e1facf949c9bc0db665db879c580e2f6 (patch) | |
| tree | 629a0a1c2af519dbef732a68c22e9379e687779a /doc/lispref/debugging.texi | |
| parent | 63f251724c324fc04d987877d06ca62ac1735b0a (diff) | |
| download | emacs-5b776637e1facf949c9bc0db665db879c580e2f6.tar.gz emacs-5b776637e1facf949c9bc0db665db879c580e2f6.zip | |
Make a start on a Profiling section in the lispref
* doc/lispref/debugging.texi (Profiling): New section, in progress.
* doc/lispref/tips.texi (Compilation Tips): Move profiling to separate section.
* doc/lispref/elisp.texi: Add Profiling to detailed menu.
Diffstat (limited to 'doc/lispref/debugging.texi')
| -rw-r--r-- | doc/lispref/debugging.texi | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 11532b19781..53d739f2295 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi | |||
| @@ -43,6 +43,7 @@ function (@pxref{Terminal Output}). | |||
| 43 | * Edebug:: A source-level Emacs Lisp debugger. | 43 | * Edebug:: A source-level Emacs Lisp debugger. |
| 44 | * Syntax Errors:: How to find syntax errors. | 44 | * Syntax Errors:: How to find syntax errors. |
| 45 | * Test Coverage:: Ensuring you have tested all branches in your code. | 45 | * Test Coverage:: Ensuring you have tested all branches in your code. |
| 46 | * Profiling:: Measuring the resources that your code uses. | ||
| 46 | @end menu | 47 | @end menu |
| 47 | 48 | ||
| 48 | @node Debugger | 49 | @node Debugger |
| @@ -809,3 +810,42 @@ never return. If it ever does return, you get a run-time error. | |||
| 809 | Edebug also has a coverage testing feature (@pxref{Coverage | 810 | Edebug also has a coverage testing feature (@pxref{Coverage |
| 810 | Testing}). These features partly duplicate each other, and it would | 811 | Testing}). These features partly duplicate each other, and it would |
| 811 | be cleaner to combine them. | 812 | be cleaner to combine them. |
| 813 | |||
| 814 | |||
| 815 | @node Profiling | ||
| 816 | @section Profiling | ||
| 817 | @cindex profiling | ||
| 818 | @cindex measuring resource usage | ||
| 819 | @cindex memory usage | ||
| 820 | |||
| 821 | If your program is working correctly, but you want to make it run more | ||
| 822 | quickly or efficiently, the first thing to do is @dfn{profile} your | ||
| 823 | code that you know how it is using resources. If you find that one | ||
| 824 | particular function is responsible for a significant portion of the | ||
| 825 | runtime, you can start by looking for ways to optimize that piece. | ||
| 826 | |||
| 827 | Emacs has built-in support for this. To begin profiling, type | ||
| 828 | @kbd{M-x profiler-start}. You can choose to profile by processor | ||
| 829 | usage, memory usage, or both. After doing some work, type | ||
| 830 | @kbd{M-x profiler-report} to display a summary buffer for each | ||
| 831 | resource that you chose to profile. The names of the report buffers | ||
| 832 | include the times at which the reports were generated, so you can | ||
| 833 | generate another report later on without erasing previous results. | ||
| 834 | When you have finished profiling, type @kbd{M-x profiler-stop} (there | ||
| 835 | is a small overhead associated with profiling). | ||
| 836 | |||
| 837 | @c FIXME | ||
| 838 | @c Basic apperance of the report buffer: | ||
| 839 | |||
| 840 | @c The following commands are available in the report buffer: | ||
| 841 | |||
| 842 | @cindex @file{elp.el} | ||
| 843 | @cindex timing programs | ||
| 844 | The @file{elp} library offers an alternative approach. See the file | ||
| 845 | @file{elp.el} for instructions. | ||
| 846 | |||
| 847 | @cindex @file{benchmark.el} | ||
| 848 | @cindex benchmarking | ||
| 849 | You can check the speed of individual Emacs Lisp forms using the | ||
| 850 | @file{benchmark} library. See the functions @code{benchmark-run} and | ||
| 851 | @code{benchmark-run-compiled} in @file{benchmark.el}. | ||