RTLLog2ODF

From Apache OpenOffice Wiki
Jump to: navigation, search

Introduction

RTLLog2ODF is an analysis tool for log files created using the RTL_LOGFILE feature. It is similar to the existing RTL_LOGFILE analysis perl scripts, from which the parser logic has been adopted. It takes one or more RTL log files as input, and creates an ODF spreadsheet. How the performance data is presented in the spreadsheet can be controlled by a set of XPath expressions.

The creation of the spreadsheet takes places in two steps. In a first step, the text based RTL log file is converted into an intermediate XML file. In a second step, the XML tree is converted into an ODF spreadsheet. Two kinds of conversions are available: In the detailed conversion, a set of sheets is created, there each sheet contains the data for a log file, a thread, a particular load save operation, or another sub tree of the log file. In the summary conversion, each sheet additionally contains column group where each group contains the data for load/save operation, ot another sub tree of the log file.

Source Code

The source code for RTLLog2ODF is available in the performance projects SVN repository.

Building RTLLog2ODF

RTLLog2ODF is written in Java. The rtllog2odf folder in performance projects SVN repository contains a NetBeans project where the usual NetBeans targets can be used to build RTLLog2ODF. Alternatively, Ant can be called directly with the build.xml file which is located in the rtllog2odf folder.

RTLLog2ODF requires odfdom.jar from the ODFDOM project at build and at run time.

Command Line

The RTL_LOGFILE analysis tool is invoked by one of these commands:

java -jar rtllog2odf.jar  -d <rtl log file> [<rtl log file> ...] <xml file>
java -jar rtllog2odf.jar  [-t <xpath>] [-T <xpath>] [-i <xpath>] <rtl log file> [<rtl log file> ...] <ods file>
java -jar rtllog2odf.jar  -s [-t <xpath>] [-T <xpath>] -g <xpath> [-G <xpath>] [-i <xpath>] <rtl log file> [<rtl log file> ...] <ods file>
java -jar rtllog2odf.jar  -c [-t <xpath>] [-T <xpath>] -g <xpath> -G <xpath> <rtl log file> [<rtl log file> ...] <ods file>
java -jar rtllog2odf.jar  -p <profile> <rtl log file> [<rtl log file> ...] <ods file>

If -d is not provided, the given RTL log files <rtl log file> are transformed into a spreadsheet document <ods file>. A sheet is created for each node in the intermediate XML file] that is matched by the [http://www.w3.org/TR/xpath XPath expression specified with the option -t. A title for the spreadsheet can be specified by the option -T. The XPath expression specified by this option is evaluated with the nodes selected by -t as context nodes, and the resulting string value is used as title.

If -s is provided, the results on the sheet are grouped into columns. For each sub tree in the intermediate XML file, a set of columns is created that contains the entries for that group. The groups are selected by the -g option, which takes an XPath expression that is evaluated with the nodes specified by -t as context nodes. The number of entries must be the same for each group. The same applies to their function names and messages. A title for each group can be specified by the -G option, which takes an XPath expression that is evaluated with the nodes selected by the -g option as context nodes.

If -s is provided with a -t options that results in two sheets, then an additional sheet is generated that list the time differences between the sheets for the two log files.

If -c is provided, a row is added to the sheets only for entries specified by the -g option. The header of the row is specified by the -G option. Both options take XPath expressions. -g is evaluated with the context nodes specified by -t. -G is evaluated with the context nodes specified by -g.

The -i option allows to specify an include filter. It takes a boolean XPath expression, which is evaluated for each descendant node of the nodes selected by the -t and -g options. Only nodes where the result of evaluating the expression is true are included.

If -d is provided, the given RTL log files are transformed into an XML file only.

If -p is specified a profile is selected. A profile is a set of XPath expressions for the above options.

XPath Expressions

The XPath expressions that control the generation of the spreadsheet support the following extension functions:

Name Descriptions
rtllog:filename(path) returns the filename part of path. path may be a filesystem path or an URI.
rtllog:filesize(path[,uncompressed]) returns the size of the file path. path may be a filesystem path or a file URI. uncompressed is a Boolean parameter. If its value is true and if the file denoted by path is a zip file, then the sum of the uncompressed sizes of the content.xml, styles.xml, meta.xml and settings.xml sub files is returned.
rtllog:qtim(string) if the first and last characters of string are both ' or ", then string is returned without its first and last character. Otherwise string is returned unmodified.

Profiles

The following profiles are predefined. To get a list of all profiles that are available RTLLog2XML may be called without arguments.

threads

RTLLog2ODF -p thread <log files>

Displays the data of each thread on a separate sheet. The corresponding command line options are:

-t "//thread" -T "concat('Thread ',@thread-id)"

files

RTLLog2ODF -p files <log files>

Displays the data of each log file on a separate sheet. The corresponding command line options are:

-t "//file" -T "@name"

load-summary

RTLLog2ODF -p load-summary <log file> <comparison log file>
RTLLog2ODF -p load-summary <log files>

Displays the data of each log file on a separate sheet. Each sheets lists the file whose load times are recorded in the log file, as well as the load times itself. The corresponding command line options are:

-t "//file" -T "rtllog:filename(@name)" -g ".//block[@function='::SfxFrameLoader::load']" 
-G "rtllog:filename(substring-after(.//stamp[@function='SfxObjectShell::LoadOwnFormat' and starts-with(.,'loading ')],' '))"
-i "@function='none'"

This profile is useful to compare the load times between two log files. If exactly two log file are specified, then a third sheet is inserted that summarizes the changes between the two log files.

save-summary

RTLLog2ODF -p save-summary <log file> <comparison log file>
RTLLog2ODF -p save-summary <log files>

Displays the data of each log file on a separate sheet. Each sheets lists the file whose save times are recorded in the log file, as well as the save times itself. The corresponding options command line options are:

-t "//file" -T "rtllog:filename(@name)" -g ".//block[@function='SfxObjectShell::SaveTo_Impl']" 
-G "rtllog:filename(substring-after(.//stamp[@function='SfxObjectShell::SaveTo_Impl' and starts-with(.,'saving ')],' '))" 
-i "@function='none'"

This profile is useful to compare the save times between two log files. If exactly two log file are specified, then a third sheet is inserted that summarizes the changes between the two log files.

load-writer-summary

RTLLog2ODF -p load-summary-writer <log file> <comparison log file>
RTLLog2ODF -p load-summary-writer <log files>

Like load-summary, except that te times for ReadThroughComponent function calls are included. The corresponding options command line options are:

-t "//file" -T "rtllog:filename(@name)" -g ".//block[@function='::SfxFrameLoader::load']" 
-G "rtllog:filename(substring-after(.//stamp[@function='SfxObjectShell::LoadOwnFormat' and starts-with(.,'loading ')],' '))"
-i "@function='ReadThroughComponent'"

save-writer-summary

RTLLog2ODF -p save-summary-writer <log file> <comparison log file>
RTLLog2ODF -p save-summary-writer <log files>

Like save-summary, except that te times for SwXMLWriter::WriteThroughComponent method calls are included. The corresponding options command line options are:

-t "//file" -T "rtllog:filename(@name)" -g ".//block[@function='SfxObjectShell::SaveTo_Impl']" 
-G "rtllog:filename(substring-after(.//stamp[@function='SfxObjectShell::SaveTo_Impl' and starts-with(.,'saving ')],' '))" 
-i "@function='SwXMLWriter::WriteThroughComponent'"

load-compact

RTLLog2ODF -p load-compact <log files>
RTLLog2ODF -p load-compact <dir>

Displays all files that are loaded in any of the given log files. For each such file, a row is created that list

  • the load duration,
  • the file size (compressed and uncompressed, where uncompressed means the sum of the content.xml, styles.xml, meta.xml and settings.xml sizes)
  • the load speed (compressed and uncompressed, where uncompressed means the sum of the content.xml, styles.xml, meta.xml and settings.xml sizes)

Instead of a list of log files, a directory that contains log files may be specified.

This is a build-in profile for which no corresponding command line does exist.

save-compact

RTLLog2ODF -p load-compact <log files>
RTLLog2ODF -p load-compact <dir>

Displays all files that are saved in any of the given log files. For each such file, a row is created that list

  • the save duration,
  • the file size (compressed and uncompressed, where uncompressed means the sum of the content.xml, styles.xml, meta.xml and settings.xml sizes)
  • the save speed (compressed and uncompressed, where uncompressed means the sum of the content.xml, styles.xml, meta.xml and settings.xml sizes)

Instead of a list of log files, a directory that contains log files may be specified.

This is a build-in profile for which no corresponding command line does exist.

Intermediate XML File Format

The intermediate XML File contains the following elements and attributes:

<root>

<root> is the root element. It has no attributes. The child elements are <comment> and <file>.

<comment>

The <comment> element contains a comment. It is created for all lines in the RTL log file which do not start with a time stamp.

<file>

The <file> element contains the data for a single log file. One <file> element is created for each file name that is passed as parameter to RTLLog2XML. The file name is included in the attribute name. The child elements are <thread>.

<file>

The <thread> element contains the data for a single thread. The thread id is included in the attribute thread-id. The child elements are <block> and <stamp>.

<block>

The <block> element contains the data of RTL log file lines which have a type { or }. A single <block> element is created for each matching pair of these lines. The function attribute contains the function name, if present in the log file line. The owner attribute contains the author, if present in the log file line. The component attribute contains the component, if present in the log file line. The start-time attribute contains the time stamp included in the { line. The end-time attribute contains the time stamp included in the } line. Both time stamps are specified as XSD durations.

<stamp>

The <stamp> element contains the data of RTL log file lines which have a type |. The function attribute contains the function name, if present in the log file line. The owner attribute contains the author, if present in the log file line. The component attribute contains the component, if present in the log file line. The time attribute contains the time stamp included in the | line as XSD duration.

Personal tools