trace/traceviewer/com.nokia.traceviewer.help/html/tasks/externalfilter.htm
changeset 11 5b9d4d8641ce
equal deleted inserted replaced
10:ed1c9f64298a 11:5b9d4d8641ce
       
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
       
     2 <html>
       
     3 <head>
       
     4 <title>Using an external filter application</title>
       
     5 <link href="../../book.css" type="text/css" rel="stylesheet"></head>
       
     6 <body>
       
     7 
       
     8 <h2>Using an external filter application</h2>
       
     9 <p>You can specify an external filter application used while tracing. 
       
    10 Every trace is then pushed to the <b>stdin</b> of the specified application. 
       
    11 The application can handle the trace in various ways (write it to file, 
       
    12 modify it, and so on), or write it back to the <b>stdout</b>, where 
       
    13 TraceViewer will catch it and write it to the view.</p> <p>To use an 
       
    14 external filter application, do the following:</p>
       
    15 <ol>
       
    16 <li>Define the external filter application in TraceViewer's preferences. For
       
    17 more information, see <a href="../reference/preferencesadvanced.htm">Advanced
       
    18 settings</a>.</li>
       
    19 <li>To launch the application, click the <b>Start external Filter command
       
    20 </b> button on the TraceViewer toolbar.
       
    21 <p></p><img src="images/externalFilterToolbar.png"alt="Start external Filter button"></li>
       
    22 <li>To stop the application, click the <b>Stop external Filter</b> button.</li>
       
    23 </ol>
       
    24 
       
    25 <h3>Dealing with rules</h3>
       
    26 <p>If there are normal filter rules defined in TraceViewer, they are 
       
    27 applied <b>after</b> traces have been processed through the external 
       
    28 filter application. This means that only Text rules are applied
       
    29 because the format is changed to text. </p>
       
    30 <ul>
       
    31 <li>If there are Text rules defined, all traces coming from the external filter
       
    32 application are run through those rules, and if a line does not hit a rule,
       
    33 it will not be shown in the view.</li>
       
    34 <li>If no Text rules are defined, all traces coming from the external application
       
    35 are shown. </li>
       
    36 </ul>
       
    37 <p>For more information, see <a href="setup_rules.htm">Setting up
       
    38 rules and filters</a>.</p>
       
    39 
       
    40 <h3>Example of script and trace output</h3>
       
    41 <p>The following Perl script uses automatic flushing because otherwise some traces
       
    42 can be left in a buffer and never get back to TraceViewer. The script reads
       
    43 from the <b>sdtin</b>, gets a line, adds the text "Prefix: " in front of the
       
    44 line and prints it back to the <b>stdout</b> for TraceViewer to catch.</p> 
       
    45 
       
    46 <pre>#!perl -w
       
    47 
       
    48 use English;
       
    49 use Strict;
       
    50 
       
    51 $OUTPUT_AUTOFLUSH = 1;
       
    52 
       
    53 while (&lt;>) {
       
    54   print "Prefix: " . $_;
       
    55 }</pre>
       
    56 <p></p>
       
    57 <p>As a result, the following traces are displayed:</p>
       
    58 <img src="images/externalFilterView.png" alt="TraceViewer view with the above Perl script"><br>
       
    59 <p><b>Note:</b> If the external filter application does not print traces back to
       
    60 the <b>stdout</b>, no traces will be visible in the TraceViewer view. Also,
       
    61 the external filter application does not have to be a Perl script as in this
       
    62 example, it can be anything, as long it gets data from <b>stdin</b> and writes
       
    63 it back to <b>stdout</b>.</p>
       
    64 
       
    65 <h5>Related tasks</h5>
       
    66 <ul>
       
    67 	<li><a href="advancedfilter.htm">Setting filtering options</a></li>
       
    68 </ul>
       
    69 
       
    70 <div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
       
    71 </body>
       
    72 </html>