Sophie

Sophie

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

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 -- lcnt</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/tools-2.6.8.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Tools</strong><br><strong>Reference Manual</strong><br><small>Version 2.6.8</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li id="no" title="cover " expanded="false">cover<ul>
<li><a href="cover.html">
                  Top of manual page
                </a></li>
<li title="start-0"><a href="cover.html#start-0">start/0</a></li>
<li title="start-1"><a href="cover.html#start-1">start/1</a></li>
<li title="compile-1"><a href="cover.html#compile-1">compile/1</a></li>
<li title="compile-2"><a href="cover.html#compile-2">compile/2</a></li>
<li title="compile_module-1"><a href="cover.html#compile_module-1">compile_module/1</a></li>
<li title="compile_module-2"><a href="cover.html#compile_module-2">compile_module/2</a></li>
<li title="compile_directory-0"><a href="cover.html#compile_directory-0">compile_directory/0</a></li>
<li title="compile_directory-1"><a href="cover.html#compile_directory-1">compile_directory/1</a></li>
<li title="compile_directory-2"><a href="cover.html#compile_directory-2">compile_directory/2</a></li>
<li title="compile_beam-1"><a href="cover.html#compile_beam-1">compile_beam/1</a></li>
<li title="compile_beam_directory-0"><a href="cover.html#compile_beam_directory-0">compile_beam_directory/0</a></li>
<li title="compile_beam_directory-1"><a href="cover.html#compile_beam_directory-1">compile_beam_directory/1</a></li>
<li title="analyse-1"><a href="cover.html#analyse-1">analyse/1</a></li>
<li title="analyse-2"><a href="cover.html#analyse-2">analyse/2</a></li>
<li title="analyse-2"><a href="cover.html#analyse-2">analyse/2</a></li>
<li title="analyse-3"><a href="cover.html#analyse-3">analyse/3</a></li>
<li title="analyse_to_file-1"><a href="cover.html#analyse_to_file-1">analyse_to_file/1</a></li>
<li title="analyse_to_file-2"><a href="cover.html#analyse_to_file-2">analyse_to_file/2</a></li>
<li title="analyse_to_file-2"><a href="cover.html#analyse_to_file-2">analyse_to_file/2</a></li>
<li title="analyse_to_file-3"><a href="cover.html#analyse_to_file-3">analyse_to_file/3</a></li>
<li title="async_analyse_to_file-1"><a href="cover.html#async_analyse_to_file-1">async_analyse_to_file/1</a></li>
<li title="async_analyse_to_file-2"><a href="cover.html#async_analyse_to_file-2">async_analyse_to_file/2</a></li>
<li title="async_analyse_to_file-2"><a href="cover.html#async_analyse_to_file-2">async_analyse_to_file/2</a></li>
<li title="async_analyse_to_file-3"><a href="cover.html#async_analyse_to_file-3">async_analyse_to_file/3</a></li>
<li title="modules-0"><a href="cover.html#modules-0">modules/0</a></li>
<li title="imported_modules-0"><a href="cover.html#imported_modules-0">imported_modules/0</a></li>
<li title="imported-0"><a href="cover.html#imported-0">imported/0</a></li>
<li title="which_nodes-0"><a href="cover.html#which_nodes-0">which_nodes/0</a></li>
<li title="is_compiled-1"><a href="cover.html#is_compiled-1">is_compiled/1</a></li>
<li title="reset-1"><a href="cover.html#reset-1">reset/1</a></li>
<li title="reset-0"><a href="cover.html#reset-0">reset/0</a></li>
<li title="export-1"><a href="cover.html#export-1">export/1</a></li>
<li title="export-2"><a href="cover.html#export-2">export/2</a></li>
<li title="import-1"><a href="cover.html#import-1">import/1</a></li>
<li title="stop-0"><a href="cover.html#stop-0">stop/0</a></li>
<li title="stop-1"><a href="cover.html#stop-1">stop/1</a></li>
</ul>
</li>
<li id="no" title="cprof " expanded="false">cprof<ul>
<li><a href="cprof.html">
                  Top of manual page
                </a></li>
<li title="analyse-0"><a href="cprof.html#analyse-0">analyse/0</a></li>
<li title="analyse-1"><a href="cprof.html#analyse-1">analyse/1</a></li>
<li title="analyse-1"><a href="cprof.html#analyse-1">analyse/1</a></li>
<li title="analyse-2"><a href="cprof.html#analyse-2">analyse/2</a></li>
<li title="pause-0"><a href="cprof.html#pause-0">pause/0</a></li>
<li title="pause-1"><a href="cprof.html#pause-1">pause/1</a></li>
<li title="pause-2"><a href="cprof.html#pause-2">pause/2</a></li>
<li title="pause-3"><a href="cprof.html#pause-3">pause/3</a></li>
<li title="restart-0"><a href="cprof.html#restart-0">restart/0</a></li>
<li title="restart-1"><a href="cprof.html#restart-1">restart/1</a></li>
<li title="restart-2"><a href="cprof.html#restart-2">restart/2</a></li>
<li title="restart-3"><a href="cprof.html#restart-3">restart/3</a></li>
<li title="start-0"><a href="cprof.html#start-0">start/0</a></li>
<li title="start-1"><a href="cprof.html#start-1">start/1</a></li>
<li title="start-2"><a href="cprof.html#start-2">start/2</a></li>
<li title="start-3"><a href="cprof.html#start-3">start/3</a></li>
<li title="stop-0"><a href="cprof.html#stop-0">stop/0</a></li>
<li title="stop-1"><a href="cprof.html#stop-1">stop/1</a></li>
<li title="stop-2"><a href="cprof.html#stop-2">stop/2</a></li>
<li title="stop-3"><a href="cprof.html#stop-3">stop/3</a></li>
</ul>
</li>
<li id="no" title="eprof " expanded="false">eprof<ul>
<li><a href="eprof.html">
                  Top of manual page
                </a></li>
<li title="start-0"><a href="eprof.html#start-0">start/0</a></li>
<li title="start_profiling-1"><a href="eprof.html#start_profiling-1">start_profiling/1</a></li>
<li title="start_profiling-2"><a href="eprof.html#start_profiling-2">start_profiling/2</a></li>
<li title="stop_profiling-0"><a href="eprof.html#stop_profiling-0">stop_profiling/0</a></li>
<li title="profile-1"><a href="eprof.html#profile-1">profile/1</a></li>
<li title="profile-1"><a href="eprof.html#profile-1">profile/1</a></li>
<li title="profile-2"><a href="eprof.html#profile-2">profile/2</a></li>
<li title="profile-3"><a href="eprof.html#profile-3">profile/3</a></li>
<li title="profile-4"><a href="eprof.html#profile-4">profile/4</a></li>
<li title="profile-5"><a href="eprof.html#profile-5">profile/5</a></li>
<li title="analyze-0"><a href="eprof.html#analyze-0">analyze/0</a></li>
<li title="analyze-1"><a href="eprof.html#analyze-1">analyze/1</a></li>
<li title="analyze-2"><a href="eprof.html#analyze-2">analyze/2</a></li>
<li title="log-1"><a href="eprof.html#log-1">log/1</a></li>
<li title="stop-0"><a href="eprof.html#stop-0">stop/0</a></li>
</ul>
</li>
<li title="erlang.el"><a href="erlang.el.html">erlang.el</a></li>
<li id="no" title="fprof " expanded="false">fprof<ul>
<li><a href="fprof.html">
                  Top of manual page
                </a></li>
<li title="start-0"><a href="fprof.html#start-0">start/0</a></li>
<li title="stop-0"><a href="fprof.html#stop-0">stop/0</a></li>
<li title="stop-1"><a href="fprof.html#stop-1">stop/1</a></li>
<li title="apply-2"><a href="fprof.html#apply-2">apply/2</a></li>
<li title="apply-3"><a href="fprof.html#apply-3">apply/3</a></li>
<li title="apply-3"><a href="fprof.html#apply-3">apply/3</a></li>
<li title="apply-4"><a href="fprof.html#apply-4">apply/4</a></li>
<li title="trace-2"><a href="fprof.html#trace-2">trace/2</a></li>
<li title="trace-2"><a href="fprof.html#trace-2">trace/2</a></li>
<li title="trace-2"><a href="fprof.html#trace-2">trace/2</a></li>
<li title="trace-1"><a href="fprof.html#trace-1">trace/1</a></li>
<li title="trace-1"><a href="fprof.html#trace-1">trace/1</a></li>
<li title="trace-1"><a href="fprof.html#trace-1">trace/1</a></li>
<li title="trace-1"><a href="fprof.html#trace-1">trace/1</a></li>
<li title="profile-0"><a href="fprof.html#profile-0">profile/0</a></li>
<li title="profile-2"><a href="fprof.html#profile-2">profile/2</a></li>
<li title="profile-1"><a href="fprof.html#profile-1">profile/1</a></li>
<li title="profile-1"><a href="fprof.html#profile-1">profile/1</a></li>
<li title="profile-1"><a href="fprof.html#profile-1">profile/1</a></li>
<li title="analyse-0"><a href="fprof.html#analyse-0">analyse/0</a></li>
<li title="analyse-2"><a href="fprof.html#analyse-2">analyse/2</a></li>
<li title="analyse-1"><a href="fprof.html#analyse-1">analyse/1</a></li>
<li title="analyse-1"><a href="fprof.html#analyse-1">analyse/1</a></li>
<li title="analyse-1"><a href="fprof.html#analyse-1">analyse/1</a></li>
</ul>
</li>
<li id="no" title="instrument " expanded="false">instrument<ul>
<li><a href="instrument.html">
                  Top of manual page
                </a></li>
<li title="allocator_descr-2"><a href="instrument.html#allocator_descr-2">allocator_descr/2</a></li>
<li title="block_header_size-1"><a href="instrument.html#block_header_size-1">block_header_size/1</a></li>
<li title="class_descr-2"><a href="instrument.html#class_descr-2">class_descr/2</a></li>
<li title="descr-1"><a href="instrument.html#descr-1">descr/1</a></li>
<li title="holes-1"><a href="instrument.html#holes-1">holes/1</a></li>
<li title="mem_limits-1"><a href="instrument.html#mem_limits-1">mem_limits/1</a></li>
<li title="memory_data-0"><a href="instrument.html#memory_data-0">memory_data/0</a></li>
<li title="memory_status-1"><a href="instrument.html#memory_status-1">memory_status/1</a></li>
<li title="read_memory_data-1"><a href="instrument.html#read_memory_data-1">read_memory_data/1</a></li>
<li title="read_memory_status-1"><a href="instrument.html#read_memory_status-1">read_memory_status/1</a></li>
<li title="sort-1"><a href="instrument.html#sort-1">sort/1</a></li>
<li title="store_memory_data-1"><a href="instrument.html#store_memory_data-1">store_memory_data/1</a></li>
<li title="store_memory_status-1"><a href="instrument.html#store_memory_status-1">store_memory_status/1</a></li>
<li title="sum_blocks-1"><a href="instrument.html#sum_blocks-1">sum_blocks/1</a></li>
<li title="type_descr-2"><a href="instrument.html#type_descr-2">type_descr/2</a></li>
<li title="type_no_range-1"><a href="instrument.html#type_no_range-1">type_no_range/1</a></li>
</ul>
</li>
<li id="loadscrollpos" title="lcnt " expanded="true">lcnt<ul>
<li><a href="lcnt.html">
                  Top of manual page
                </a></li>
<li title="start-0"><a href="lcnt.html#start-0">start/0</a></li>
<li title="stop-0"><a href="lcnt.html#stop-0">stop/0</a></li>
<li title="collect-0"><a href="lcnt.html#collect-0">collect/0</a></li>
<li title="collect-1"><a href="lcnt.html#collect-1">collect/1</a></li>
<li title="clear-0"><a href="lcnt.html#clear-0">clear/0</a></li>
<li title="clear-1"><a href="lcnt.html#clear-1">clear/1</a></li>
<li title="conflicts-0"><a href="lcnt.html#conflicts-0">conflicts/0</a></li>
<li title="conflicts-1"><a href="lcnt.html#conflicts-1">conflicts/1</a></li>
<li title="locations-0"><a href="lcnt.html#locations-0">locations/0</a></li>
<li title="locations-1"><a href="lcnt.html#locations-1">locations/1</a></li>
<li title="inspect-1"><a href="lcnt.html#inspect-1">inspect/1</a></li>
<li title="inspect-2"><a href="lcnt.html#inspect-2">inspect/2</a></li>
<li title="information-0"><a href="lcnt.html#information-0">information/0</a></li>
<li title="swap_pid_keys-0"><a href="lcnt.html#swap_pid_keys-0">swap_pid_keys/0</a></li>
<li title="load-1"><a href="lcnt.html#load-1">load/1</a></li>
<li title="save-1"><a href="lcnt.html#save-1">save/1</a></li>
<li title="apply-1"><a href="lcnt.html#apply-1">apply/1</a></li>
<li title="apply-2"><a href="lcnt.html#apply-2">apply/2</a></li>
<li title="apply-3"><a href="lcnt.html#apply-3">apply/3</a></li>
<li title="pid-2"><a href="lcnt.html#pid-2">pid/2</a></li>
<li title="pid-3"><a href="lcnt.html#pid-3">pid/3</a></li>
<li title="port-1"><a href="lcnt.html#port-1">port/1</a></li>
<li title="port-2"><a href="lcnt.html#port-2">port/2</a></li>
<li title="rt_collect-0"><a href="lcnt.html#rt_collect-0">rt_collect/0</a></li>
<li title="rt_collect-1"><a href="lcnt.html#rt_collect-1">rt_collect/1</a></li>
<li title="rt_clear-0"><a href="lcnt.html#rt_clear-0">rt_clear/0</a></li>
<li title="rt_clear-1"><a href="lcnt.html#rt_clear-1">rt_clear/1</a></li>
<li title="rt_opt-1"><a href="lcnt.html#rt_opt-1">rt_opt/1</a></li>
<li title="rt_opt-2"><a href="lcnt.html#rt_opt-2">rt_opt/2</a></li>
</ul>
</li>
<li id="no" title="make " expanded="false">make<ul>
<li><a href="make.html">
                  Top of manual page
                </a></li>
<li title="all-0"><a href="make.html#all-0">all/0</a></li>
<li title="all-1"><a href="make.html#all-1">all/1</a></li>
<li title="files-1"><a href="make.html#files-1">files/1</a></li>
<li title="files-2"><a href="make.html#files-2">files/2</a></li>
</ul>
</li>
<li id="no" title="tags " expanded="false">tags<ul>
<li><a href="tags.html">
                  Top of manual page
                </a></li>
<li title="file-1"><a href="tags.html#file-1">file/1</a></li>
<li title="files-1"><a href="tags.html#files-1">files/1</a></li>
<li title="dir-1"><a href="tags.html#dir-1">dir/1</a></li>
<li title="dirs-1"><a href="tags.html#dirs-1">dirs/1</a></li>
<li title="subdir-1"><a href="tags.html#subdir-1">subdir/1</a></li>
<li title="subdirs-1"><a href="tags.html#subdirs-1">subdirs/1</a></li>
<li title="root-1"><a href="tags.html#root-1">root/1</a></li>
</ul>
</li>
<li id="no" title="xref " expanded="false">xref<ul>
<li><a href="xref.html">
                  Top of manual page
                </a></li>
<li title="add_application-2"><a href="xref.html#add_application-2">add_application/2</a></li>
<li title="add_directory-2"><a href="xref.html#add_directory-2">add_directory/2</a></li>
<li title="add_module-2"><a href="xref.html#add_module-2">add_module/2</a></li>
<li title="add_release-2"><a href="xref.html#add_release-2">add_release/2</a></li>
<li title="analyze-2"><a href="xref.html#analyze-2">analyze/2</a></li>
<li title="d-1"><a href="xref.html#d-1">d/1</a></li>
<li title="forget-1"><a href="xref.html#forget-1">forget/1</a></li>
<li title="forget-2"><a href="xref.html#forget-2">forget/2</a></li>
<li title="format_error-1"><a href="xref.html#format_error-1">format_error/1</a></li>
<li title="get_default-1"><a href="xref.html#get_default-1">get_default/1</a></li>
<li title="get_default-2"><a href="xref.html#get_default-2">get_default/2</a></li>
<li title="get_library_path-1"><a href="xref.html#get_library_path-1">get_library_path/1</a></li>
<li title="info-1"><a href="xref.html#info-1">info/1</a></li>
<li title="info-2"><a href="xref.html#info-2">info/2</a></li>
<li title="info-3"><a href="xref.html#info-3">info/3</a></li>
<li title="m-1"><a href="xref.html#m-1">m/1</a></li>
<li title="m-1"><a href="xref.html#m-1">m/1</a></li>
<li title="q-2"><a href="xref.html#q-2">q/2</a></li>
<li title="remove_application-2"><a href="xref.html#remove_application-2">remove_application/2</a></li>
<li title="remove_module-2"><a href="xref.html#remove_module-2">remove_module/2</a></li>
<li title="remove_release-2"><a href="xref.html#remove_release-2">remove_release/2</a></li>
<li title="replace_application-3"><a href="xref.html#replace_application-3">replace_application/3</a></li>
<li title="replace_module-3"><a href="xref.html#replace_module-3">replace_module/3</a></li>
<li title="set_default-3"><a href="xref.html#set_default-3">set_default/3</a></li>
<li title="set_default-2"><a href="xref.html#set_default-2">set_default/2</a></li>
<li title="set_library_path-2"><a href="xref.html#set_library_path-2">set_library_path/2</a></li>
<li title="start-1"><a href="xref.html#start-1">start/1</a></li>
<li title="start-2"><a href="xref.html#start-2">start/2</a></li>
<li title="stop-1"><a href="xref.html#stop-1">stop/1</a></li>
<li title="update-1"><a href="xref.html#update-1">update/1</a></li>
<li title="variables-1"><a href="xref.html#variables-1">variables/1</a></li>
</ul>
</li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>lcnt</h1></center>
    
    <h3>MODULE</h3>
<div class="REFBODY">lcnt</div>
    <h3>MODULE SUMMARY</h3>
<div class="REFBODY">A runtime system Lock Profiling tool.</div>
    <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
	<p>The <span class="code">lcnt</span> module is used to profile the internal ethread locks in the
	    Erlang Runtime System. With <span class="code">lcnt</span> enabled, Internal counters in the
	    runtime system are updated each time a lock is taken. The counters stores
	    information about the number of acquisition tries and the number of collisions
	    that has occurred during the acquisition tries. The counters also record the
	    waiting time a lock has caused for a blocked thread when a collision has occurred.
	</p>
	<p>
	    The data produced by the lock counters will give an estimate on how well
	    the runtime system will behave from a parallelizable view point for the
	    scenarios tested. This tool was mainly developed to help erlang runtime
	    developers iron out potential and generic bottlenecks.
	</p>
	<p>Locks in the emulator are named after what type of resource they protect and where
	    in the emulator they are initialized, those are lock 'classes'. Most of those
	    locks are also instantiated several times, and given unique identifiers, to increase
	    locking granularity. Typically an instantiated lock protects a disjunct set of
	    the resource, i.e ets-tables, processes or ports. In other cases it protects a
	    specific range of a resource, e.g. <span class="code">pix_lock</span> which protects index to process
	    mappings, and is given a unique number within the class. A unique lock in <span class="code">lcnt</span>
	    is referenced by a name (class) and an identifier, <span class="code">{Name, Id}</span>.
	</p>
	<p>Some locks in the system are static and protects global resources, for example
	    <span class="code">bif_timers</span> and the <span class="code">run_queue</span> locks. Other locks are dynamic and not
	    necessarily long lived, for example process locks and ets-table locks. The
	    statistics data from short lived locks can be stored separately when the locks
	    are deleted. This behavior is by default turned off to save memory but can be
	    turned on via <span class="code">lcnt:rt_opt({copy_save, true})</span>. The <span class="code">lcnt:apply/1,2,3</span>
	    functions enables this behavior during profiling.
	</p>
    </p></div>
    <h3>EXPORTS</h3>

	<p><a name="start-0"><span class="bold_code">start() -&gt; {ok, Pid} | {error, {already_started, Pid}} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Starts the lock profiler server. The server only act as a medium for the
		    user and performs filtering and printing of data collected by <span class="code">lcnt:collect/1</span>.
		</p>
	    </p></div>

	<p><a name="stop-0"><span class="bold_code">stop() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p>
		<p>Stops the lock profiler server.</p>
	    </p></div>

	<p><a name="collect-0"><span class="bold_code">collect() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p><p>Same as <span class="code">collect(node())</span>.</p></p></div>

	<p><a name="collect-1"><span class="bold_code">collect(Node) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Node = node()</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Collects lock statistics from the runtime system. The function starts a
		    server if it is not already started. It then populates the server with lock
		    statistics. If the server held any lock statistics data before the collect then
		    that data is lost.
		</p>
		<div class="note">
<div class="label">Note</div>
<div class="content"><p>
		    <p>
			When collection occurs the runtime system transitions to a single thread,
			blocking all other threads. No other tasks will be scheduled during this
			operation. Depending on the size of the data this might take a long time
			(several seconds) and cause timeouts in the system.
		    </p>
		</p></div>
</div>
	    </p></div>

	<p><a name="clear-0"><span class="bold_code">clear() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p><p>Same as <span class="code">clear(node())</span>.</p></p></div>

	<p><a name="clear-1"><span class="bold_code">clear(Node) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Node = node()</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Clears the internal lock statistics from the runtime system. This does not clear the
		    data on the server only on runtime system. All counters for static locks are zeroed,
		    all dynamic locks currently alive are zeroed and all saved locks now destroyed are removed.
		    It also resets the duration timer.
		</p>
	    </p></div>
	<p><a name="conflicts-0"><span class="bold_code">conflicts() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p><p>Same as <span class="code">conflicts([])</span>.</p></p></div>
	<p><a name="conflicts-1"><span class="bold_code">conflicts([Option]) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Option     = {sort, Sort} | {reverse, bool()} | {thresholds, [Thresholds]} | {print, [Print | {Print, integer()}]} | {max_locks, MaxLocks} | {combine, bool()}</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Sort       = name | id | type | tries | colls | ratio | time | entry</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Thresholds = {tries, integer()} | {colls, integer()} | {time, integer()}</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Print      = name | id | type | entry | tries | colls | ratio | time | duration</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">MaxLocks   = integer() | none</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Prints a list of internal locks and its statistics.</p>
		<p>For option description, see <span class="bold_code"><a href="#inspect-2">lcnt:inspect/2</a></span>.</p>
	    </p></div>

	<p><a name="locations-0"><span class="bold_code">locations() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p>
		<p>Same as <span class="code">locations([])</span>.</p>
	    </p></div>
	<p><a name="locations-1"><span class="bold_code">locations([Option]) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Option     = {sort, Sort} | {thresholds, [Thresholds]} | {print, [Print | {Print, integer()}]} | {max_locks, MaxLocks} | {combine, bool()}</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Sort       = name | id | type | tries | colls | ratio | time | entry</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Thresholds = {tries, integer()} | {colls, integer()} | {time, integer()}</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Print      = name | id | type | entry | tries | colls | ratio | time | duration</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">MaxLocks   = integer() | none</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Prints a list of internal lock counters by source code locations.</p>
		<p>For option description, see <span class="bold_code"><a href="#inspect-2">lcnt:inspect/2</a></span>.</p>
	    </p></div>

	<p><a name="inspect-1"><span class="bold_code">inspect(Lock) -&gt; ok</span></a><br></p>
<div class="REFBODY"><p><p>Same as <span class="code">inspect(Lock, [])</span>.</p></p></div>
	<p><a name="inspect-2"><span class="bold_code">inspect(Lock, [Option]) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Lock       = Name | {Name, Id | [Id]}</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Name       = atom() | pid() | port()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Id         = atom() | integer() | pid() | port()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Option     = {sort, Sort} | {thresholds, [Thresholds]} | {print, [Print | {Print, integer()}]} | {max_locks, MaxLocks} | {combine, bool()} | {locations, bool()}</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Sort       = name | id | type | tries | colls | ratio | time</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Thresholds = {tries, integer()} | {colls, integer()} | {time, integer()}</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Print      = name | id | type | entry | tries | colls | ratio | time | duration</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">MaxLocks   = integer() | none</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Prints a list of internal lock counters for a specific lock.</p>
		<p>Lock <span class="code">Name</span> and <span class="code">Id</span> for ports and processes are interchangeable with the use of <span class="code">lcnt:swap_pid_keys/0</span> and is the reason why <span class="code">pid()</span> and <span class="code">port()</span> options can be used in both <span class="code">Name</span> and <span class="code">Id</span> space. Both pids and ports are special identifiers with stripped creation and can be recreated with <span class="bold_code"><a href="#pid-3">lcnt:pid/2,3</a></span> and <span class="bold_code"><a href="#port-2">lcnt:port/1,2</a></span>.  </p>
		<p>Option description:</p>
		<dl>
		    <dt><strong><span class="code">{combine, bool()}</span></strong></dt>
		    <dd>Combine the statistics from different instances of a lock class.
			<br>Default: <span class="code">true</span>
		    </dd>

		    <dt><strong><span class="code">{locations, bool()}</span></strong></dt>
		    <dd>Print the statistics by source file and line numbers.
			<br>Default: <span class="code">false</span>
		    </dd>

		    <dt><strong><span class="code">{max_locks, MaxLocks}</span></strong></dt>
		    <dd>Maximum number of locks printed or no limit with <span class="code">none</span>.
			<br>Default: <span class="code">20</span>
		    </dd>

		    <dt><strong><span class="code">{print, PrintOptions}</span></strong></dt>
		    <dd>Printing options:
			<dl>
			    <dt><strong><span class="code">name</span></strong></dt>
			    <dd>Named lock or named set of locks (classes). The same name used for initializing the lock in the VM.</dd>

			    <dt><strong><span class="code">id</span></strong></dt>
			    <dd>Internal id for set of locks, not always unique. This could be table name for ets tables (db_tab), port id for ports, integer identifiers for allocators, etc.</dd>

			    <dt><strong><span class="code">type</span></strong></dt>
			    <dd>Type of lock: <span class="code">rw_mutex</span>, <span class="code">mutex</span>, <span class="code">spinlock</span>, <span class="code">rw_spinlock</span> or <span class="code">proclock</span>.</dd>

			    <dt><strong><span class="code">entry</span></strong></dt>
			    <dd>In combination with <span class="code">{locations, true}</span> this option prints the lock operations source file and line number entry-points along with statistics for each entry. </dd>

			    <dt><strong><span class="code">tries</span></strong></dt>
			    <dd>Number of acquisitions of this lock.</dd>

			    <dt><strong><span class="code">colls</span></strong></dt>
			    <dd>Number of collisions when a thread tried to acquire this lock. This is when a trylock is EBUSY, a write try on read held rw_lock, a try read on write held rw_lock, a thread tries to lock an already locked lock. (Internal states supervises this).</dd>

			    <dt><strong><span class="code">ratio</span></strong></dt>
			    <dd>The ratio between the number of collisions and the number of tries (acquisitions) in percentage.</dd>

			    <dt><strong><span class="code">time</span></strong></dt>
			    <dd>Accumulated waiting time for this lock. This could be greater than actual wall clock time, it is accumulated for all threads. Trylock conflicts does not accumulate time.</dd>

			    <dt><strong><span class="code">duration</span></strong></dt>
			    <dd>Percentage of accumulated waiting time of wall clock time. This percentage can be higher than 100% since accumulated time is from all threads.</dd>
			</dl>
			<br>Default: <span class="code">[name,id,tries,colls,ratio,time,duration]</span>
		    </dd>

		    <dt><strong><span class="code">{reverse, bool()}</span></strong></dt>
		    <dd>Reverses the order of sorting.
			<br>Default: <span class="code">false</span>
		    </dd>

		    <dt><strong><span class="code">{sort, Sort}</span></strong></dt>
		    <dd>Column sorting orders.
			<br>Default: <span class="code">time</span>
		    </dd>

		    <dt><strong><span class="code">{thresholds, Thresholds}</span></strong></dt>
		    <dd>Filtering thresholds. Anything values above the threshold value are passed through.
			<br>Default: <span class="code">[{tries, 0}, {colls, 0}, {time, 0}]</span>
		    </dd>

		</dl>

	    </p></div>

	<p><a name="information-0"><span class="bold_code">information() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p>
		<p>Prints lcnt server state and generic information about collected lock statistics.</p>
	    </p></div>

	<p><a name="swap_pid_keys-0"><span class="bold_code">swap_pid_keys() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p>
		<p>Swaps places on <span class="code">Name</span> and <span class="code">Id</span> space for ports and processes.</p>
	    </p></div>

	<p><a name="load-1"><span class="bold_code">load(Filename) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Filename = filename()</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Restores previously saved data to the server.</p>
	    </p></div>

	<p><a name="save-1"><span class="bold_code">save(Filename) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Filename = filename()</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Saves the collected data to file.</p>
	    </p></div>
    

    <h3><a name="id86543">Convenience functions</a></h3>
<div class="REFBODY">
	
	<p>The following functions are used for convenience.</p>
    </div>
    <h3>EXPORTS</h3>
	<p><a name="apply-1"><span class="bold_code">apply(Fun) -&gt; term()</span></a><br></p>
<div class="REFBODY"><p>
		<p>Same as <span class="code">apply(Fun, [])</span>.</p>
	    </p></div>
	<p><a name="apply-2"><span class="bold_code">apply(Fun, Args) -&gt; term()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Fun = fun()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Args = [term()]</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p> Clears the lock counters and then setups the instrumentation to save all destroyed locks.
		    After setup the fun is called, passing the elements in <span class="code">Args</span> as arguments.
		    When the fun returns the statistics are immediately collected to the server. After the
		    collection the instrumentation is returned to its previous behavior.
		    The result of the applied fun is returned.
		</p>
	    </p></div>
	<p><a name="apply-3"><span class="bold_code">apply(Module, Function, Args) -&gt; term()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Module = atom()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Function = atom()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Args = [term()]</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p> Clears the lock counters and then setups the instrumentation to save all destroyed locks.
		    After setup the function is called, passing the elements in <span class="code">Args</span> as arguments.
		    When the function returns the statistics are immediately collected to the server. After the
		    collection the instrumentation is returned to its previous behavior.
		    The result of the applied function is returned.
		</p>
	    </p></div>

	<p><a name="pid-2"><span class="bold_code">pid(Id, Serial) -&gt; pid()</span></a><br></p>
<div class="REFBODY"><p><p>Same as <span class="code">pid(node(), Id, Serial)</span>.</p></p></div>
	<p><a name="pid-3"><span class="bold_code">pid(Node, Id, Serial) -&gt; pid()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Node = node()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Id = integer()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Serial = integer()</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Creates a process id with creation 0. Example:</p>
	    </p></div>

	<p><a name="port-1"><span class="bold_code">port(Id) -&gt; port()</span></a><br></p>
<div class="REFBODY"><p><p>Same as <span class="code">port(node(), Id)</span>.</p></p></div>
	<p><a name="port-2"><span class="bold_code">port(Node, Id) -&gt; port()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Node = node()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Id = integer()</span><br>
</div>
	    </div>
<div class="REFBODY"><p><p>Creates a port id with creation 0.</p></p></div>

    

    <h3><a name="id86771">Internal runtime lock counter controllers</a></h3>
<div class="REFBODY">
	
	<p> The following functions control the behavior of the internal counters.  </p>
    </div>

    <h3>EXPORTS</h3>
	<p><a name="rt_collect-0"><span class="bold_code">rt_collect() -&gt; [lock_counter_data()]</span></a><br></p>
<div class="REFBODY"><p> <p>Same as <span class="code">rt_collect(node())</span>.</p> </p></div>
	<p><a name="rt_collect-1"><span class="bold_code">rt_collect(Node) -&gt; [lock_counter_data()]</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Node = node()</span><br>
</div>
	    </div>
<div class="REFBODY"><p> <p>Returns a list of raw lock counter data.</p> </p></div>

	<p><a name="rt_clear-0"><span class="bold_code">rt_clear() -&gt; ok</span></a><br></p>
<div class="REFBODY"><p> <p>Same as <span class="code">rt_clear(node())</span>.</p> </p></div>
	<p><a name="rt_clear-1"><span class="bold_code">rt_clear(Node) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Node = node()</span><br>
</div>
	    </div>
<div class="REFBODY"><p> <p>Clear the internal counters. Same as <span class="code">lcnt:clear(Node)</span>.</p></p></div>

	<p><a name="rt_opt-1"><span class="bold_code">rt_opt({Type, bool()}) -&gt; bool()</span></a><br></p>
<div class="REFBODY"><p> <p>Same as <span class="code">rt_opt(node(), {Type, Opt})</span>.</p> </p></div>
	<p><a name="rt_opt-2"><span class="bold_code">rt_opt(Node, {Type, bool()}) -&gt; bool()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
		<div class="REFTYPES">
<span class="bold_code">Node = node()</span><br>
</div>
		<div class="REFTYPES">
<span class="bold_code">Type = copy_save | process_locks</span><br>
</div>
	    </div>
<div class="REFBODY"><p>
		<p>Changes the lock counter behavior and returns the previous behaviour.</p>
		<p>Option description:</p>
		<dl>
		    <dt><strong><span class="code">{copy_save, bool()}</span></strong></dt>
		    <dd>Enable statistics saving from destroyed locks by copying. This might consume a lot of memory.
			<br>Default: <span class="code">false</span>
		    </dd>

		    <dt><strong><span class="code">{process_locks, bool()}</span></strong></dt>
		    <dd>Profile process locks.
			<br>Default: <span class="code">true</span>
		    </dd>
		</dl>
	    </p></div>
    

    <h3><a name="id86990">See Also</a></h3>
<div class="REFBODY">
	
	<p> <span class="bold_code"><a href="lcnt_chapter.html">LCNT User's Guide</a></span></p>
    </div>
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>