How To Generate Profiling DataAndre Fischer and Carsten Driesner, July 11th , 2001. Last change on August 2nd , 2001. IntroductionThe task that is to be solved is the generation of profiling data for a manually selected set of points in programs of the OpenOffice/Sun One Webtop family. Moreover this should be accomplished as automatically as possible, so that timings of different program versions can be compared to each other automatically. The main reason for not using an existing tool like Truetime or Quantify is the huge amount of data generated by these programs. In general the developers of the different modules of the office know about the time critical parts of their code. Therefore only profiling informations about these code parts are of interest. Everything else only obscures the view to the relevant data. With this in mind we use a different approach. Instead of blindly instrumenting---i.e. adding code that generates profiling data---all files, we concentrate of the areas of interest. The developers have to add once manually commands into their code that emits time stamps together with context information. From then on everything else goes automatically. If the those files are compiled with a certain preprocessor symbol defined and the office is run with a certain environment variable set, then profiling information is written to a log file (or, to be more precise, to one log file per process). These log files are then processed by a Perl script and are transfomed into a Calc document. The details of this process are explained below. Note that this is a work in progress. Especially the transformation of the log files into a Calc document will have to be adapted to the needs of those who use those documents. Instrumenting the source filesThe header file <rtl/logfile.hxx> (guarded by the
preprocessor symbol
will do that (4NT). The macros can be used in two ways:
For every introduced above there is an analogon without the
Depending on which of these two ways is used to generate a time stamp, they are named function/scope time stamps respectively message time stamps. Creating profiling informationIf you have instrumented your code like described above and have
compiled and installed it you can create profiling information by
starting the office with the bootsrap variable
Transforming the log files into Calc documentsOnce you have created a log file you may want to convert it into a more readable form. There is a set of Perl scripts that create a Calc document from a log file that contains for every thread a set of pages with different views of the profiling data. The first page shows a pretty printed version of the list of time stamps. They are indented according to the calling hierarchy. For each time stamp you can see the time it has been written (or to be more precise the time on which it's writing has been requested), if applicable the time the function/scope took to compute and the function/scope name and message. The second page shows a list of all functions/scopes for which timing informations exist. Every list entry shows the function/scope name, total, minimal, maximal, and average time and the number of calls. FilteringThe list of time stamps can be filtered in order to reduce a large
amount of data to a managable size and to exclude profiling
information from projects you are not interested in. There are two
filters. One is for explicit inclusion of time stamps, the other for
explicit exclusion. Each is initialized from a file containing
regular expressions (Perl style) given on the command line. The file
after the The idea is to use the inclusion filter if you have just a small number of functions or messages you are interested in and to use the exclusion filter if there is only a small number you would not like in your reports. An inclusion file might look like this.
OutlookThe form and number of reports will of course have to be changed and extended. We are looking forward to your feedback. Further DocumentationFurthor documentation can be found in the C++ header files
Documentation of the time stamp format can be found here. ContactYou can contact the authors under andre.w.fischer@sun.com or carsten.driesner@sun.com.
|

