Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-testing > by-pkgid > 2c50825dd66d0497b96a67f7fab2ee84 > files > 9333

openoffice.org64-devel-doc-2.4.1.10-1mdv2008.1.x86_64.rpm

<html>
<head>
<title>class Logfile</title>
<link rel="stylesheet" type="text/css" href="../../cpp.css">
</head>
<body>
<div id="adc-cppref">

<a name="_top_"> </a><table class="navimain" border="0" cellpadding="1" cellspacing="0">
<tr align="center" valign="top">
<td class="navimain">&nbsp;<a href="../../index.html">Overview</a>&nbsp;</td>
<td class="navimain">&nbsp;<a href="index.html">Namespace</a>&nbsp;</td>
<td class="navimainself">&nbsp;Class&nbsp;</td>
<td class="navimain">&nbsp;<a href="../../index-files/index-1.html">Index</a>&nbsp;</td>
<td class="navimain">&nbsp;<a href="../../help.html">Help</a>&nbsp;</td>
</tr>
</table>
<table class="navisub" cellpadding="0" cellspacing="3">
<tr>
<td width="20%"><font size="-2">PUBLIC MEMBERS:</font></td>
<td>
&nbsp;<font size="-2">CLASSES</font>
|&nbsp;<font size="-2">STRUCTS</font>
|&nbsp;<font size="-2">UNIONS</font>
|&nbsp;<font size="-2">ENUMS</font>
|&nbsp;<font size="-2">TYPEDEFS</font>
|&nbsp;<a href="#publ_ops"><font size="-2"><b>METHODS</b></font></a>
|&nbsp;<font size="-2">STATIC METHODS</font>
|&nbsp;<font size="-2">DATA</font>
|&nbsp;<font size="-2">STATIC DATA</font></td>
</tr>
<tr>
<td width="20%"><font size="-2">PRIVATE MEMBERS:</font></td>
<td>
&nbsp;<font size="-2">CLASSES</font>
|&nbsp;<font size="-2">STRUCTS</font>
|&nbsp;<font size="-2">UNIONS</font>
|&nbsp;<font size="-2">ENUMS</font>
|&nbsp;<font size="-2">TYPEDEFS</font>
|&nbsp;<font size="-2">METHODS</font>
|&nbsp;<font size="-2">STATIC METHODS</font>
|&nbsp;<a href="#priv_vars"><font size="-2"><b>DATA</b></font></a>
|&nbsp;<font size="-2">STATIC DATA</font></td>
</tr>
</table>
<hr>
<a href="../../names/index.html" alt="Global Namespace in C++"><font size="+1"><b>::</b></font></a> <a href="index.html" alt="namespace"><font size="+1"><b>rtl</b></font></a><font size="+1"> :: </font><div class="title"><h2>class Logfile</h2>
</div><hr>
<dl>
<dt>Base Classes</dt>
<dd>None.</dd>
</dl>
<dl>
<dt>Known Derived Classes</dt>
<dd>None.</dd>
</dl>
<br>
<table class="flag-table" border="1" cellspacing="0">
<tr>
<td width="25%" class="flagname">virtual</td>
<td width="25%" class="flagname">abstract</td>
<td width="25%" class="flagname">interface</td>
<td width="25%" class="flagname">template</td>
</tr>
<tr>
<td class="flagno">NO</td>
<td class="flagno">NO</td>
<td class="flagno">NO</td>
<td class="flagno">NO</td>
</tr>
</table>
<dl>
<dt>Description</dt>
<dd>The intended use for class Logfile is to write time stamp information
for profiling purposes. 

Profiling output should only be generated for a special product version of OpenOffice
which is compiled with a defined preprocessor symbol 'TIMELOG'.  
Therefore we have provided a set of macros that uses the class Logfile only if
this symbol is defined.  If the macros are not sufficient, i.e. you need more
then three arguments for a printf style message, then you have to insert an
#ifdef TIMELOG/#endif brace yourself.

Additionally the environment variable RTL_LOGFILE has to be defined in order to generate
logging information. If the variable is not empty, it creates a file with the name
$(RTL_LOGFILE)_$(PID).log, where $(PID) is the process id of the running process.
It can be used as a run time switch for enabling or disabling the logging.
Note that this variable is evaluated only once at the first attempt to write a message.

The class LogFile collects runtime data within its constructor and destructor. It can be
used for timing whole functions. 
If you want to write timing data without context you can use the RTL_LOGFILE_TRACE-macros
which are defined inside <rtl/logfile.h>.

The class LogFile should not be used directly, instead use the RTL_LOGFILE_CONTEXT/
RTL_LOGFILE_TRACE-macros.

Macro usage:
------------
RTL_LOGFILE_CONTEXT( instance, name );
This macro creates an instance of class LogFile with the name "instance" and writes the current time,
thread id and "name" to the log file.

Example: RTL_LOGFILE_CONTEXT( aLog, "Timing for foo-method" );

RTL_LOGFILE_CONTEXT_TRACE( instance, mesage );
RTL_LOGFILE_CONTEXT_TRACEn( instance, frmt, arg1, .., arg3 );
These macros can be used to log information in a "instance" context. The "instance" object
is used to log message informations. All macros with "frmt" uses printf notation to log timing infos.

Example: RTL_LOGFILE_CONTEXT_TRACE( aLog, "Now we call an expensive function" );
         RTL_LOGFIlE_CONTEXT_TRACE1( aLog, "Config entries read: %u", (unsigned short)i );

RTL_LOGFILE_TRACE( string );
RTL_LOGFILE_TRACEn( frmt, arg1, .., arg3 );
These macros can be used to log information outside a context. The macro directly calls 
rtl_logfile_trace to write the info to the log file. All macros with "frmt" uses printf 
notation to log timing infos.

Example: RTL_LOGFILE_TRACE( "Timing for loading a file" );
         RTL_LOGFILE_TRACE1( aLog, "Timing for loading file: %s", aFileName );

The lines written to the log file consist of the following space separated elements:
1.    The time relative to the start of the global timer in milliseconds.  The times is
    started typically for the first logged line.
2.    Thread id.  It's absolut value is probably of less interest than providing a way to
    distinguish different threads.
3.    a.    An opening or closing curly brace indicating the start or end of a scope.
        4a. Function name or general scope identifier.
    b.    A vertical line indicating an arbitrary message.
        4b optional function name or general scope identifier.
        5b A colon followed by a space and a free form message terminated by a newline.
    
There is a second version of creating a context. RTL_LOGFILE_CONTEXT_AUTHOR takes
two more arguments, the name of the project and the author's sign who is responsible
for the code in which the macro is used.
</dd>
</dl>
<dl>
<dt>File</dt>
<dd>logfile.hxx</dd>
</dl>
<hr>
<dl>
<dt class="subtitle"><a name="publ_"><h3>Public Members</h3>
</a></dt>
<dd><a name="publ_ops"> </a><table class="childlist" border="1" cellpadding="5" cellspacing="0" width="100%">
<tr class="subtitle">
<td colspan="2"><h4>Methods</h4>
</td>
</tr>
<tr>
<td> <br>
<a href="Logfile/o.html#Logfile-1062">Logfile</a>( const sal_Char * name );</td>
<td width="50%"> </td>
</tr>
<tr>
<td> <br>
<a href="Logfile/o.html#Logfile-1063">Logfile</a>( const sal_Char * project, const sal_Char * author, const sal_Char * name );</td>
<td width="50%"> </td>
</tr>
<tr>
<td> <br>
<a href="Logfile/o.html#~Logfile-1064">~Logfile</a>( );</td>
<td width="50%"> </td>
</tr>
<tr>
<td>const sal_Char * <br>
<a href="Logfile/o.html#getName-1065">getName</a>( );</td>
<td width="50%"> </td>
</tr>
</table>
<hr>
</dd>
</dl>
<dl>
<dt class="subtitle"><a name="priv_"><h3>Private Members</h3>
</a></dt>
<dd><a name="priv_vars"> </a><table class="childlist" border="1" cellpadding="5" cellspacing="0" width="100%">
<tr class="subtitle">
<td colspan="2"><h4>Data</h4>
</td>
</tr>
<tr bgcolor="white">
<td>::rtl::<a href="c-OString.html">OString</a> <a href="Logfile/d.html#m_sName"><strong>m_sName;</strong></a></td>
<td/></tr>
</table>
<hr>
</dd>
</dl>
<a href="#_top_" class="objchapter">Top of Page</a><hr size="3"><p class="copyright" align="center">Copyright &copy; 2008 Sun Microsystems, Inc.</p>

</div> <!-- id="adc-cppref" -->
</body>

</html>