The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Devel::STrace::Monitor</title>
<link rel="stylesheet" type="text/css" href="../../podstyle.css" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div class="box">
  <h1 class="t1">Devel::STrace</h1>
  <table>
    <tr>
      <td class="label">Description</td>
      <td class="cell">strace for Perl scripts</td>
    </tr>
  </table>
</div>
<div class="path">
  <a href="../../index.html">Devel::STrace</a> &gt; Package Manuals &gt;
  Devel-STrace-Monitor
</div>
<div>
<a href="../../Devel/STrace/Monitor.html">Classdocs</a>
</div>


<div class="pod">
<!-- INDEX START -->
<h3 id="TOP">Index</h3>
<ul>
	<li><a href="#NAME">NAME</a></li>
	<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
	<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
	<li><a href="#METHODS">METHODS</a></li>
	<li><a href="#SEE_ALSO">SEE ALSO</a></li>
	<li><a href="#AUTHOR_COPYRIGHT_AND_LICENSE">AUTHOR, COPYRIGHT, AND LICENSE</a></li>
</ul>
<hr />
<!-- INDEX END -->

<h1 id="NAME">NAME <a href="#TOP" class="toplink"><img alt="^" src="../../up.gif" /></a></h1>

<p>Devel::STrace::Monitor - Monitor interface component for Devel::STrace</p>

<h1 id="SYNOPSIS">SYNOPSIS <a href="#TOP" class="toplink"><img alt="^" src="../../up.gif" /></a></h1>

<pre>    #
    #    open the mmap'ed file
    #
    use Devel::STrace::Monitor;

    my $view = Devel::STrace::Monitor-&gt;open('somefile.map');

    my $cycles = 0;
    while (1) {
        print &quot;\n**************************************\n&quot;;
    #
    #    refresh the internal ringbuffer map
    #
        $view-&gt;refresh();
    #
    #    dump the current traces
    #
        $view-&gt;trace(\&amp;dump_trace);

        sleep 10;
    }
    #
    #    method to display the traces
    #
    sub dump_trace {
        my ($key, $slot, $depth, $line, $time, $entry) = @_;

        $lastkey = $key,
        print &quot;\n**************************************\n&quot;
            unless ($lastkey eq $key);

        if ($time) {
    #
    #    trim the weekday and year from timestamp
    #
            my $frac = ($time - int($time)) * 1000000;
            $frac=~s/\..*$//;
            my @parts = split(/\s+/, scalar localtime($time));
            pop @parts;    # get rid of year
            print &quot;$key($depth) : $slot : $entry:$line at &quot;,
                join(' ', @parts), '.', $frac, &quot;\n&quot;;
        }
        else {
            print &quot;$key($depth) : $slot : $entry:$line (No timestamp)\n&quot;;
        }
    }

</pre><h1 id="DESCRIPTION">DESCRIPTION <a href="#TOP" class="toplink"><img alt="^" src="../../up.gif" /></a></h1>

<p>Provides methods to</p>

<ul>
	<li>attach to and read the memory mapped file generated by <a href="../STrace.pod.html">Devel::STrace</a>
(or future full featured debuggers) using <a href="http://search.cpan.org/perldoc?Devel%3A%3ARingBuffer">Devel::RingBuffer</a>.</li>
	<li>set or clear any of the <code>$DB::single</code>, <code>$DB::trace</code>, or <code>$DB::signal</code>
control variables of the AUT (via their tie'd interfaces in the AUT).</li>
	<li>inspect the current execution call stack of the AUT</li>
</ul>

<p>The interfaces provide a simple framework for building
an external application that can attach to a running
Perl application, monitor its current execution, and eventually
detach, all while permitting the application continue to run
uninterrupted.</p>

<p>A more complete debugger module is planned to exploit
the various command/control structures available via <a href="http://search.cpan.org/perldoc?Devel%3A%3ARingBuffer">Devel::RingBuffer</a>.
Note that this module will be fully compatible with the resulting
debugger so that, e.g., an application can first be monitored
to detect troublespots, and then the debugger can be attached
to fully debug the problem.</p>

<h1 id="METHODS">METHODS <a href="#TOP" class="toplink"><img alt="^" src="../../up.gif" /></a></h1>

<p>Refer to the include classdocs for summary and detail method
descriptions.</p>

<h1 id="SEE_ALSO">SEE ALSO <a href="#TOP" class="toplink"><img alt="^" src="../../up.gif" /></a></h1>

<p><a href="../STrace.pod.html">Devel::STrace</a></p>

<p><a href="http://search.cpan.org/perldoc?Devel%3A%3ARingBuffer">Devel::RingBuffer</a></p>

<p><a href="http://search.cpan.org/perldoc?IPC%3A%3AMmap">IPC::Mmap</a></p>

<p><code>plstrace.pl</code> is a simple command line script using this module.</p>

<h1 id="AUTHOR_COPYRIGHT_AND_LICENSE">AUTHOR, COPYRIGHT, AND LICENSE <a href="#TOP" class="toplink"><img alt="^" src="../../up.gif" /></a></h1>

<p>Dean Arnold <a href="mailto:darnold@presicient.com">mailto:darnold@presicient.com</a></p>

<p>Copyright(C) 2006, Dean Arnold, Presicient Corp., USA.
All rights reserved.</p>

<p>Permission is granted to use this software under the same terms as Perl itself.
Refer to the <a href="http://search.cpan.org/perldoc?perlartistic">Perl Artistic License</a> for details.</p>


</div><div class="footer">generated by <a href="http://search.cpan.org/perldoc?Pod%3A%3AProjectDocs">Pod::ProjectDocs</a></div></body>
</html>