Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 959

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- Testing and tools</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/megaco-3.16.0.2.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Megaco/H.248</strong><br><strong>User's Guide</strong><br><small>Version 3.16.0.2</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Chapters</strong></small></p>
<ul class="flipMenu" imagepath="../../../../doc/js/flipmenu">
<li id="no" title="Introduction" expanded="false">Introduction<ul>
<li><a href="megaco_intro.html">
              Top of chapter
            </a></li>
<li title="Scope and Purpose"><a href="megaco_intro.html#id56570">Scope and Purpose</a></li>
<li title="Prerequisites"><a href="megaco_intro.html#id65628">Prerequisites</a></li>
<li title="About This Manual"><a href="megaco_intro.html#id61790">About This Manual</a></li>
<li title="Where to Find More Information"><a href="megaco_intro.html#id62066">Where to Find More Information</a></li>
</ul>
</li>
<li id="no" title="Architecture" expanded="false">Architecture<ul>
<li><a href="megaco_architecture.html">
              Top of chapter
            </a></li>
<li title="Network view"><a href="megaco_architecture.html#id58224">Network view</a></li>
<li title="General"><a href="megaco_architecture.html#id65139">General</a></li>
<li title="Single node config"><a href="megaco_architecture.html#id60119">Single node config</a></li>
<li title="Distributed config"><a href="megaco_architecture.html#id58176">Distributed config</a></li>
<li title="Message round-trip call flow"><a href="megaco_architecture.html#id61141">Message round-trip call flow</a></li>
</ul>
</li>
<li id="no" title="Running the stack" expanded="false">Running the stack<ul>
<li><a href="megaco_run.html">
              Top of chapter
            </a></li>
<li title="Starting"><a href="megaco_run.html#id64614">Starting</a></li>
<li title="MGC startup call flow"><a href="megaco_run.html#id65587">MGC startup call flow</a></li>
<li title="MG startup call flow"><a href="megaco_run.html#id64564">MG startup call flow</a></li>
<li title="Configuring the Megaco stack"><a href="megaco_run.html#id65484">Configuring the Megaco stack</a></li>
<li title="Initial configuration"><a href="megaco_run.html#id65269">Initial configuration</a></li>
<li title="Changing the configuration"><a href="megaco_run.html#id65365">Changing the configuration</a></li>
<li title="The transaction sender"><a href="megaco_run.html#id64741">The transaction sender</a></li>
<li title="Segmentation of transaction replies"><a href="megaco_run.html#id64873">Segmentation of transaction replies</a></li>
</ul>
</li>
<li id="no" title="Internal form and its encodings" expanded="false">Internal form and its encodings<ul>
<li><a href="megaco_encode.html">
              Top of chapter
            </a></li>
<li title="Internal form of messages"><a href="megaco_encode.html#id64187">Internal form of messages</a></li>
<li title="The different encodings"><a href="megaco_encode.html#id64304">The different encodings</a></li>
<li title="Configuration of Erlang distribution encoding module"><a href="megaco_encode.html#id64461">Configuration of Erlang distribution encoding module</a></li>
<li title="Configuration of text encoding module(s)"><a href="megaco_encode.html#id65758">Configuration of text encoding module(s)</a></li>
<li title="Configuration of binary encoding module(s)"><a href="megaco_encode.html#id65967">Configuration of binary encoding module(s)</a></li>
<li title="Handling megaco versions"><a href="megaco_encode.html#id66078">Handling megaco versions</a></li>
<li title="Encoder callback functions"><a href="megaco_encode.html#id66326">Encoder callback functions</a></li>
</ul>
</li>
<li id="no" title="Transport mechanisms" expanded="false">Transport mechanisms<ul>
<li><a href="megaco_transport_mechanisms.html">
              Top of chapter
            </a></li>
<li title="Callback interface"><a href="megaco_transport_mechanisms.html#id66413">Callback interface</a></li>
<li title="Examples"><a href="megaco_transport_mechanisms.html#id66482">Examples</a></li>
</ul>
</li>
<li id="no" title="Implementation examples" expanded="false">Implementation examples<ul>
<li><a href="megaco_examples.html">
              Top of chapter
            </a></li>
<li title="A simple Media Gateway Controller"><a href="megaco_examples.html#id66572">A simple Media Gateway Controller</a></li>
<li title="A simple Media Gateway"><a href="megaco_examples.html#id66620">A simple Media Gateway</a></li>
</ul>
</li>
<li id="no" title="Megaco mib" expanded="false">Megaco mib<ul>
<li><a href="megaco_mib.html">
              Top of chapter
            </a></li>
<li title="Intro"><a href="megaco_mib.html#id66738">Intro</a></li>
<li title="Statistics counters"><a href="megaco_mib.html#id66763">Statistics counters</a></li>
<li title="Distribution"><a href="megaco_mib.html#id66799">Distribution</a></li>
</ul>
</li>
<li id="no" title="Performance comparison" expanded="false">Performance comparison<ul>
<li><a href="megaco_performance.html">
              Top of chapter
            </a></li>
<li title="Comparison of encoder/decoders"><a href="megaco_performance.html#id66878">Comparison of encoder/decoders</a></li>
<li title="System performance characteristics"><a href="megaco_performance.html#id67709">System performance characteristics</a></li>
<li title="Description of encoders/decoders"><a href="megaco_performance.html#id67746">Description of encoders/decoders</a></li>
<li title="Setup"><a href="megaco_performance.html#id67856">Setup</a></li>
<li title="Summary"><a href="megaco_performance.html#id67869">Summary</a></li>
</ul>
</li>
<li id="loadscrollpos" title="Testing and tools" expanded="true">Testing and tools<ul>
<li><a href="megaco_debug.html">
              Top of chapter
            </a></li>
<li title="Tracing"><a href="megaco_debug.html#id67998">Tracing</a></li>
<li title="Measurement and transformation"><a href="megaco_debug.html#id68043">Measurement and transformation</a></li>
</ul>
</li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<h1>9 Testing and tools</h1>
  

  <h3><a name="id67998">9.1 
        Tracing</a></h3>
    
    <p>We have instrumented our code in order to enable
      tracing. Running the application with tracing deactivated,
      causes a negligible performance overhead (an external call to a
      function which returns an atom). Activation of tracing does not
      require any recompilation of the code, since we rely on
      Erlang/OTP's built in support for dynamic trace activation. In
      our case tracing of calls to a given external function.</p>
    <p>Event traces can be viewed in a generic message sequence chart
      tool, <span class="code">et</span>, or as standard output (events are written to stdio). </p>
    <p>See <span class="bold_code"><a href="megaco.html#enable_trace">enable_trace</a></span>, 
      <span class="bold_code"><a href="megaco.html#disable_trace">disable_trace</a></span> and
      <span class="bold_code"><a href="megaco.html#set_trace">set_trace</a></span> for
      more info. </p>
  

  <h3><a name="id68043">9.2 
        Measurement and transformation</a></h3>
    
    <p>We have included some simple tool(s) for codec measurement (meas),
      performance tests (mstone1 and mstone2) and message transformation.</p>
    <p>The tool(s) are located in the example/meas directory.</p>

    <h4>Requirement</h4>
      
      <ul>
        <li>
          <p>Erlang/OTP, version R13B01 or later.</p>
        </li>
        <li>
          <p>Version 3.11 or later of <strong>this</strong> application.</p>
        </li>
        <li>
          <p>Version 1.6.10 or later of the <strong>asn1</strong> application. </p>
        </li>
        <li>
          <p>The flex libraries. Without it, the flex powered codecs cannot 
            be used.</p>
        </li>
      </ul>
    

    <h4>Meas results</h4>
      
      <p>The results from the measurement run (meas) is four 
        excel-compatible textfiles: </p>
      <ul>
        <li>
          <p>decode_time.xls  -&gt; Decoding result</p>
        </li>
        <li>
          <p>encode_time.xls  -&gt; Encoding result</p>
        </li>
        <li>
          <p>total_time.xls   -&gt; Total (Decoding+encoding) result</p>
        </li>
        <li>
          <p>message_size.xls -&gt; Message size</p>
        </li>
      </ul>
    

    <h4>Instruction</h4>
      
      <p>The tool contain four things:
        </p>
      <ul>
        <li>
          <p>The transformation module</p>
        </li>
        <li>
          <p>The measurement (meas) module(s)</p>
        </li>
        <li>
          <p>The mstone (mstone1 and mstone2) module(s)</p>
        </li>
        <li>
          <p>The basic message file</p>
        </li>
      </ul>

      <h4>Message Transformation</h4>
        
        <p>The messages used by the different tools are contained in 
          single message package file (see below for more info). The messages
          in this file is encoded with just one codec. During 
          measurement initiation, the messages are read and then transformed to all
          codec formats used in the measurement. </p>
        <p>The message transformation is done by the transformation module.
          It is used to transform a set of messages encoded with one codec 
          into the other base codec's.</p>
      

      <h4>Measurement(s)</h4>
        
        <p>There are two different measurement tools: </p>
        <ul>
          <li>
            <p><strong>meas</strong>: </p>
            <p>Used to perform codec measurements. That is, to see what 
              kind of performance can be expected by the different codecs 
              provided by the megaco application. </p>
            <p>The measurement is done by iterating over the decode/encode 
              function for approx 2 seconds per message and counting 
              the number of decodes/encodes.</p>
            <p>Is best run by modifying the meas.sh.skel skeleton script
              provided by the tool.</p>
            <p>To run it manually do the following: </p>
              <div class="example"><pre>
        % erl -pa &lt;path-megaco-ebin-dir&gt; -pa &lt;path-to-meas-module-dir&gt;
        Erlang (BEAM) emulator version 5.6 [source]

        Eshell V5.7.1  (abort with ^G)
        1&gt; megaco_codec_meas:start().
        ...
        2&gt; halt().
        </pre></div>
            <p>or to make it even easier, assuming a measure shall be 
              done on all the codecs (as above):</p>
              <div class="example"><pre>
        % erl -noshell -pa &lt;path-megaco-ebin-dir&gt; \\
              -pa &lt;path-to-meas-module-dir&gt; \\
              -s megaco_codec_meas -s init stop
        </pre></div>
            <p>When run as above (this will take some time), the measurement 
              process is done as follows:</p>
        <div class="example"><pre>
For each codec:
    For each message:
        Read the message from the file
            Detect message version
            Measure decode
                Measure encode
          Write results, encode, decode and total, to file
        </pre></div>
          </li>

          <li>
            <p><strong>mstone1 and mstone2</strong>: </p>
            <p>These are two different SMP performance monitoring tool(s). </p>
            <p><strong>mstone1</strong> creates a process for each codec config supported by 
              the megaco application and let them run for a specific 
              time (all at the same time), encoding and decoding 
              megaco messages. The number of messages processed in total 
              is the mstone1(1) value. </p>
            <p>There are different ways to run the mstone1 tool, e.g. with or without 
              the use of drivers, with <strong>only</strong> flex-empowered configs. </p>
            <p>Is best run by modifying the mstone1.sh.skel skeleton script
              provided by the tool.</p>
            <p>The <strong>mstone2</strong> is similar to the <strong>mstone1</strong> tool,
              but in this case, each created process makes only <strong>one</strong> run 
              through the messages and then exits. A soon as a process exits,
              a new process (with the same config and messages) is created to takes 
              its place. 
              The number of messages processed in total 
              is the mstone2(1) value. </p>
          </li>
        </ul>

        <p>Both these tools use the message package (time_test.msgs) provided
          with the tool(s), although it can run on any message package as long as
          it has the same structure. </p>
      

      <h4>Message package file</h4>
        
        <p>This is simply an erlang compatible text-file with the following 
          structure: <span class="code">{codec_name(), messages_list()}</span>. </p>

<div class="example"><pre>
codec_name() = pretty | compact | ber | per | erlang      (how the messages are encoded)
messages_list() = [{message_name(), message()}]
message_name() = atom()
message() = binary()
</pre></div>

        <p>The codec name is the name of the codec with which all messages in
          the <span class="code">message_list()</span> has been encoded. </p>

        <p>This file can be <span class="code">exported</span> to a file structure by calling the 
          <span class="bold_code"><a href="megaco_codec_transform.html#export_messages">export_messages</a></span>
          function. This can be usefull if a measurement shall be done with
          an external tool. Exporting the messages creates a directory tree 
          with the following structure:
          </p>
        <div class="example"><pre>
&lt;message package&gt;/pretty/&lt;message-files&gt;
                  compact/
                  per/
                  ber/&lt;message-files&gt;
                  erlang/
        </pre></div>
        <p>The file includes both version 1, 2 and version 3 messages.</p>
      
    

    <h4>Notes</h4>
      

      <h4>Binary codecs</h4>
        
        <p>There are two basic ways to use the binary encodings: 
          With package related name and termination id transformation
          (the 'native' encoding config) or without. This transformation 
          converts package related names and termination id's to a more 
          convenient internal form (equivalent with the decoded text message).</p>
        <p>The transformation is done _after_ the actual decode has been 
          done.</p>
        <p>Furthermore, it is possible to make use of a linked in driver that 
          performs some of the decode/encode, decode for ber and encode for per 
          (the 'driver' encoding config).</p>
        <p>Therefor in the tests, binary codecs are tested with four 
          different encoding configs to determine exactly how the
          different options effect the performance: with transformation and 
          without driver ([]), without transformation and without driver 
          ([native]), with transformation and with driver ([driver]) and 
          finally without transformation and with driver ([driver,native]).</p>
      

      <h4>Included test messages</h4>
        
        <p>Some of these messages are ripped from the call flow examples 
          in an old version of the RFC and others are created to test
          a specific feature of megaco. </p>
      

      <h4>Measurement tool directory name</h4>
        
        <p>Be sure <strong>not</strong> no name the directory containing the measurement
          binaries starting with 'megaco-', e.g. megaco-meas. This will
          confuse the erlang application loader (erlang applications
          are named, e.g. megaco-1.0.2).</p>
      
    
  
</div>
<div class="footer">
<hr>
<p>Copyright © 2000-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>