<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.queryMeters.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.queryMeters</api:function-name><api:suggest>xdmp.querymeters</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>querymeters</api:suggest><api:function-link mode="xquery" fullname="xdmp:query-meters">/apidoc/8.0/xdmp:query-meters.xml</api:function-link><api:function mode="javascript" name="queryMeters" type="builtin" lib="xdmp" category="Extension" subcategory="MarkLogic Server" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.queryMeters"><api:summary>
  Returns the current value of the resource meters for this
  query sequence <span class="javascript" xmlns="http://www.w3.org/1999/xhtml"> as a JSON node</span>.
</api:summary><api:return class="javascript">Object</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">The resource meters returned include:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
  <dl>
  <dt>
  <span class="javascript">elapsedTime</span></dt>
  <dd>The time elapsed since the start of the processing of this query,
  in the form of a duration.</dd>
  <dt>requests</dt>
  <dd>The number of requests.</dd>
  <dt>
  <span class="javascript">listCacheHits</span></dt>
  <dd>The number of successful list cache lookups.  The list
  cache holds search termlists used to accelerate path expressions and
  text searches.</dd>
  <dt>
  <span class="javascript">listCacheMisses</span></dt>
  <dd>The number of unsuccessful list cache lookups.  Each
  unsuccessful list cache lookup was followed by a disk access to load the
  search termlist into the cache.</dd>
  <dt>
  <span class="javascript">inMemoryListHits</span></dt>
  <dd>The number of successful list lookups in in-memory
  stands.</dd>
  <dt>
  <span class="javascript">expandedTreeCacheHits</span></dt>
  <dd>The number of successful expanded tree cache lookups.
  The expanded tree cache cache holds XML document data in the expanded
  representation used by the XQuery evaluator.</dd>
  <dt>
  <span class="javascript">expandedTreeCacheMisses</span></dt>
  <dd>The number of unsuccessful expanded tree cache lookups.
  Each unsuccessful expanded tree lookup was followed by a compressed tree
  cache lookup to load the expanded tree into the cache.</dd>
  <dt>
  <span class="javascript">compressedTreeCacheHits</span></dt>
  <dd>The number of successful compressed tree cache lookups.
  The compressed tree cache holds XML document data in the compressed
  representation stored on disk.</dd>
  <dt>
  <span class="javascript">compressedTreeCacheMisses</span></dt>
  <dd>The number of unsuccessful compressed tree cache lookups.
  Each unsuccessful compressed tree cache lookup was followed by a disk
  access to load the compressed tree into the cache.</dd>
  <dt>
  <span class="javascript">inMemoryCompressedTreeHits</span></dt>
  <dd>The number of successful compressed tree lookups in
  in-memory stands.</dd>
  <dt>
  <span class="javascript">valueCacheHits</span></dt>
  <dd>The number of successful value cache lookups.  The value
  cache is a transient cache that exists only for the duration of one
  query.  It holds typed values, and is used to accelerate the frequent
  conversion of nodes to typed values.</dd>
  <dt>
  <span class="javascript">valueCacheMisses</span></dt>
  <dd>The number of unsuccessful value cache lookups.  Each
  unsuccessful value cache lookup was followed by a conversion of an XML
  node to a typed value.</dd>
  <dt>
  <span class="javascript">regexpCacheHits</span></dt>
  <dd>The number of successful regular expression cache
  lookups.  The regular expression cache is a transient cache that exists
  only for the duration of one query.  It holds compiled regular
  expressions, and is used to accelerate the frequent use of regular
  expressions during the evaluation of a query.</dd>
  <dt>
  <span class="javascript">regexpCacheMisses</span></dt>
  <dd>The number of unsuccessful regular expression cache
  lookups.  Each unsuccessful regular expression cache lookup was followed
  by a compilation of a regular expression from source text.</dd>
  <dt>
  <span class="javascript">linkCacheHits</span></dt>
  <dd>The number of successful link cache lookups.  The link
  cache is a transient cache that exists only for the duration of one
  query.  It holds pointers to expanded trees, and is used to accelerate
  the frequent dereferencing of link nodes.</dd>
  <dt>
  <span class="javascript">linkCacheMisses</span></dt>
  <dd>The number of unsuccessful link cache lookups.  Each
  unsuccessful link cache lookup was followed by a search for the
  link target tree.</dd>
  <dt>
  <span class="javascript">filterHits</span></dt>
  <dd>The number of successful search filter matches.</dd>
  <dt>
  <span class="javascript">filterMisses</span></dt>
  <dd>The number of unsuccessful search filter matches.</dd>
  <dt>
  <span class="javascript">fragmentsAdded</span></dt>
  <dd>The number of XML fragments added to the database by an
  update.</dd>
  <dt>
  <span class="javascript">fragmentsDeleted</span></dt>
  <dd>The number of XML fragments deleted from the database by
  an update.</dd>
  <dt>
  <span class="javascript">fsProgramCacheHits</span></dt>
  <dd>The number of module cache hits from the entire program made from
  modules on the file system.</dd>
  <dt>
  <span class="javascript">fsProgramCacheMisses</span></dt>
  <dd>The number of module cache misses from the entire program made from
  modules on the file system.</dd>
  <dt>
  <span class="javascript">dbProgramCacheHits</span></dt>
  <dd>The number of module cache hits from the entire program made from
  modules in a database (may contain library modules from the special
  Modules directory).</dd>
  <dt>
  <span class="javascript">dbProgramCacheMisses</span></dt>
  <dd>The number of module cache misses from the entire program made from
  modules in a database (may contain library modules from the special
  Modules directory).</dd>
  <dt>
  <span class="javascript">envProgramCacheHits</span></dt>
  <dd>The number of module cache hits from the entire program made from
  ad hoc XSLT stylesheet nodes.</dd>
  <dt>
  <span class="javascript">envProgramCacheMisses</span></dt>
  <dd>The number of module cache misses from the entire program made from
  ad hoc XSLT stylesheet nodes.</dd>
  <dt>
  <span class="javascript">fsMainModuleSequenceCacheHits</span></dt>
  <dd>The number of main module cache hits from main modules on the
  file system.</dd>
  <dt>
  <span class="javascript">fsMainModuleSequenceCacheMisses</span></dt>
  <dd>The number of main module cache misses from main modules on the
  file system.</dd>
  <dt>
  <span class="javascript">dbMainModuleSequenceCacheHits</span></dt>
  <dd>The number of main module cache hits from main modules in a
  database.</dd>
  <dt>
  <span class="javascript">dbMainModuleSequenceCacheMisses</span></dt>
  <dd>The number of main module cache misses from main modules in a
  database.</dd>
  <dt>
  <span class="javascript">fsLibraryModuleCacheHits</span></dt>
  <dd>The number of library module cache hits from library modules on the
  file system.</dd>
  <dt>
  <span class="javascript">fsLibraryModuleCacheMisses</span></dt>
  <dd>The number of library module cache misses from library modules on the
  file system.</dd>
  <dt>
  <span class="javascript">dbLibraryModuleCacheHits</span></dt>
  <dd>The number of library module cache hits from library modules from the
  modules database.</dd>
  <dt>
  <span class="javascript">dbLibraryModuleCacheMisses</span></dt>
  <dd>The number of library module cache misses from library modules from the
  modules database.</dd>
  </dl>
  </blockquote>
  <p xmlns="http://www.w3.org/1999/xhtml">Some meters are broken down by fragment root and document URI:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
  <dl>
  <dt>fragments</dt>
  <dd>A sequence of fragment elements, each containing:
  <dl>
  <dt>root</dt>
  <dd>The fragment root name.</dd>
  <dt>
  <span class="javascript">expandedTreeCacheHits</span></dt>
  <dd>A count of successful expanded tree cache lookups for this fragment
  root.</dd>
  <dt>
  <span class="javascript">expandedTreeCacheMisses</span></dt>
  <dd>A count of unsuccessful expanded tree cache lookups for this
  fragment root.</dd>
  </dl>
  </dd>
  <dt>documents</dt>
  <dd>A sequence of document elements, each containing:
  <dl>
  <dt>uri</dt>
  <dd>The document URI.</dd>
  <dt>
  <span class="javascript">expandedTreeCacheHits</span></dt>
  <dd>A count of successful expanded tree cache lookups
  for this document URI.</dd>
  <dt>
  <span class="javascript">expandedTreeCacheMisses</span></dt>
  <dd>A count of unsuccessful expanded tree cache lookups
  for this document URI.</dd>
  </dl>
  </dd>
  </dl>
  </blockquote>
  <p xmlns="http://www.w3.org/1999/xhtml">There are also meters that measure the query activity per host. There is
  a 
  <span class="javascript"><code>qm.hosts</code> member</span> with one 
  <code>
  <span class="javascript">qm.host</span></code> child per host that 
  participates in the query. Each 
  
  <span class="javascript"><code>qm.host</code> member</span>
  contains meters showing the 
  <span class="javascript">roundTripTime</span> and 
  
  <span class="javascript">roundTripCount</span> for
  communications between the evaluator host and the host referenced in the
  <code>
  <span class="javascript">xdmp.queryMeters</span></code> output. 
  The 
  <span class="javascript"><code>qm.hosts</code> member</span> is empty for 
  a single-node cluster.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Certain operations are run concurrently with the timing operations,
  and if those operations are not actually used in the query, they might not
  be included in the timings. This occurs for operations like
  <code>
  <span class="javascript">xdmp.estimate</span></code>, 
  <code>
  <span class="javascript">xdmp.exists</span></code>, and lexicon calls
  (for example, <code>
  <span class="javascript">cts.elementValues</span></code>).  If you want to see the
  total timings that include calls that are not used, you can form some other
  expression with the results of the calls.  For example, if you have an
  expression that calls <code>
  <span class="javascript">xdmp.estimate</span></code> 
  , you can add 
  0 to the output, which causes it to be included in the timings (something 
  like 
  <span class="javascript"><code>xdmp.estimate(query) + 0</code></span>).</p>
  </api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
{
  "elapsedTime": "PT0.007101S",
  "requests": 0,
  "listCacheHits": 0,
  "listCacheMisses": 0,
  "inMemoryListHits": 0,
  "tripleCacheHits": 0,
  "tripleCacheMisses": 0,
  "tripleValueCacheHits": 0,
  "tripleValueCacheMisses": 0,
  "expandedTreeCacheHits": 0,
  "expandedTreeCacheMisses": 0,
  "compressedTreeCacheHits": 0,
  "compressedTreeCacheMisses": 0,
  "inMemoryCompressedTreeHits": 0,
  "valueCacheHits": 0,
  "valueCacheMisses": 0,
  "regexpCacheHits": 0,
  "regexpCacheMisses": 0,
  "linkCacheHits": 0,
  "linkCacheMisses": 0,
  "filterHits": 0,
  "filterMisses": 0,
  "fragmentsAdded": 0,
  "fragmentsDeleted": 0,
  "fsProgramCacheHits": 0,
  "fsProgramCacheMisses": 1,
  "dbProgramCacheHits": 0,
  "dbProgramCacheMisses": 0,
  "envProgramCacheHits": 0,
  "envProgramCacheMisses": 0,
  "fsMainModuleSequenceCacheHits": 0,
  "fsMainModuleSequenceCacheMisses": 0,
  "dbMainModuleSequenceCacheHits": 0,
  "dbMainModuleSequenceCacheMisses": 0,
  "fsLibraryModuleCacheHits": 0,
  "fsLibraryModuleCacheMisses": 0,
  "dbLibraryModuleCacheHits": 0,
  "dbLibraryModuleCacheMisses": 0,
  "fragments": [ ]
,
"documents": [ ]
,
"hosts": [ ]
}

</pre></api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn.count(fn.collection());
xdmp.queryMeters().elapsedTime;

=&gt; PT0.003416S
</pre></api:example></api:function></api:function-page>