| |
| |
| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| |
| |
| |
| <title>Statistics Module — Apache Mynewt latest documentation</title> |
| |
| |
| |
| |
| <link rel="shortcut icon" href="../../../_static/mynewt-logo-only-newt32x32.png"/> |
| |
| |
| |
| |
| <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" /> |
| |
| |
| <link rel="stylesheet" href="../../../_static/css/sphinx_theme.css" type="text/css" /> |
| |
| <link rel="stylesheet" href="../../../_static/css/bootstrap-3.0.3.min.css" type="text/css" /> |
| |
| <link rel="stylesheet" href="../../../_static/css/v2.css" type="text/css" /> |
| |
| <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" /> |
| |
| <link rel="stylesheet" href="../../../_static/css/restructuredtext.css" type="text/css" /> |
| |
| |
| |
| |
| <link rel="stylesheet" href="../../../_static/css/overrides.css" type="text/css" /> |
| <link rel="index" title="Index" |
| href="../../../genindex.html"/> |
| <link rel="search" title="Search" href="../../../search.html"/> |
| <link rel="top" title="Apache Mynewt latest documentation" href="../../../index.html"/> |
| <link rel="up" title="System Modules" href="../system_modules.html"/> |
| <link rel="next" title="Console" href="../console/console.html"/> |
| <link rel="prev" title="Logging" href="../logs/logs.html"/> |
| |
| |
| <script src="../../../_static/js/modernizr.min.js"></script> |
| |
| |
| <script> |
| (function(i, s, o, g, r, a, m) { |
| i["GoogleAnalyticsObject"] = r; |
| (i[r] = |
| i[r] || |
| function() { |
| (i[r].q = i[r].q || []).push(arguments); |
| }), |
| (i[r].l = 1 * new Date()); |
| (a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]); |
| a.async = 1; |
| a.src = g; |
| m.parentNode.insertBefore(a, m); |
| })(window, document, "script", "//www.google-analytics.com/analytics.js", "ga"); |
| |
| ga("create", "UA-72162311-1", "auto"); |
| ga("send", "pageview"); |
| </script> |
| |
| |
| </head> |
| |
| <body class="not-front page-documentation" role="document" > |
| <div id="wrapper"> |
| <div class="container"> |
| <div id="banner" class="row v2-main-banner"> |
| <a class="logo-cell" href="/"> |
| <img class="logo" src="../../../_static/img/logo.png"> |
| </a> |
| <div class="tagline-cell"> |
| <h4 class="tagline">An OS to build, deploy and securely manage billions of devices</h4> |
| </div> |
| <div class="news-cell"> |
| <div class="well"> |
| <h4>Latest News:</h4> <a href="/download">Apache Mynewt 1.11.0, Apache NimBLE 1.6.0 </a> released September 7, 2023) |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| <header> |
| <nav id="navbar" class="navbar navbar-inverse" role="navigation"> |
| <div class="container"> |
| <!-- Collapsed navigation --> |
| <div class="navbar-header"> |
| <!-- Expander button --> |
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| |
| </div> |
| |
| <!-- Expanded navigation --> |
| <div class="navbar-collapse collapse"> |
| <!-- Main navigation --> |
| <ul class="nav navbar-nav navbar-right"> |
| <li> |
| <a href="/"><i class="fa fa-home" style="font-size: larger;"></i></a> |
| </li> |
| <li class="important"> |
| <a href="/quick-start/">Quick Start</a> |
| </li> |
| <li> |
| <a href="/about/">About</a> |
| </li> |
| <li> |
| <a href="/talks/">Talks</a> |
| </li> |
| <li class="active"> |
| <a href="/documentation/">Documentation</a> |
| </li> |
| <li> |
| <a href="/download/">Download</a> |
| </li> |
| <li> |
| <a href="/community/">Community</a> |
| </li> |
| <li> |
| <a href="/events/">Events</a> |
| </li> |
| </ul> |
| |
| <!-- Search, Navigation and Repo links --> |
| <ul class="nav navbar-nav navbar-right"> |
| |
| </ul> |
| </div> |
| </div> |
| </nav> |
| </header> |
| <!-- STARTS MAIN CONTENT --> |
| <div id="main-content"> |
| |
| |
| |
| |
| |
| |
| <div id="breadcrumb"> |
| <div class="container"> |
| <a href="/documentation/">Docs</a> / |
| |
| <a href="../../os_user_guide.html">OS User Guide</a> / |
| |
| <a href="../system_modules.html">System Modules</a> / |
| |
| Statistics Module |
| |
| <div class="sourcelink"> |
| <a href="https://github.com/apache/mynewt-core/edit/master/docs/os/modules/stats/stats.rst" class="icon icon-github" |
| rel="nofollow"> Edit on GitHub</a> |
| </div> |
| </div> |
| </div> |
| <!-- STARTS CONTAINER --> |
| <div class="container"> |
| <!-- STARTS .content --> |
| <div id="content" class="row"> |
| |
| <!-- STARTS .container-sidebar --> |
| <div class="container-sidebar col-xs-12 col-sm-3"> |
| <div id="docSidebar" class="sticky-container"> |
| <div role="search" class="sphinx-search"> |
| <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search documentation" class="search-documentation" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| <!-- Note: only works when deployed --> |
| <select class="form-control" onchange="if (this.value) window.location.href=this.value"> |
| <option value="/latest" selected> |
| Version: latest |
| </option> |
| <option value="/v1_11_0" > |
| Version: 1.11.0 |
| </option> |
| <option value="/v1_10_0" > |
| Version: 1.10.0 |
| </option> |
| <option value="/v1_9_0" > |
| Version: 1.9.0 |
| </option> |
| <option value="/v1_8_0" > |
| Version: 1.8.0 |
| </option> |
| <option value="/v1_7_0" > |
| Version: 1.7.0 |
| </option> |
| <option value="/v1_6_0" > |
| Version: 1.6.0 |
| </option> |
| <option value="/v1_5_0" > |
| Version: 1.5.0 |
| </option> |
| <option value="/v1_4_0" > |
| Version: 1.4.0 |
| </option> |
| <option value="/v1_3_0/os/introduction" > |
| Version: 1.3.0 |
| </option> |
| <option value="/v1_2_0/os/introduction" > |
| Version: 1.2.0 |
| </option> |
| <option value="/v1_1_0/os/introduction" > |
| Version: 1.1.0 |
| </option> |
| <option value="/v1_0_0/os/introduction" > |
| Version: 1.0.0 |
| </option> |
| <option value="/v0_9_0/os/introduction" > |
| Version: 0.9.0 |
| </option> |
| </select> |
| <div class="region region-sidebar"> |
| <div class="docs-menu"> |
| |
| |
| |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../../index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../get_started/index.html">Setup & Get Started</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../concepts.html">Concepts</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../tutorials/tutorials.html">Tutorials</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../external_links.html">Third-party Resources</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../../os_user_guide.html">OS User Guide</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../../core_os/mynewt_os.html">Kernel</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="../system_modules.html">System</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../config/config.html">Config</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../logs/logs.html">Logs</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">Statistics</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../console/console.html">Console</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../shell/shell.html">Shell</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../hal/hal.html">Hardware Abstraction</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../bootloader/bootloader.html">Secure Bootloader</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../split/split.html">Split Images</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../core_os/porting/port_os.html">Porting Guide</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../baselibc.html">Baselibc</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../drivers/driver.html">Drivers</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../devmgmt/newtmgr.html">Device Management with Newt Manager</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../mcumgr/mcumgr.html">Device Management with MCUmgr</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../imgmgr/imgmgr.html">Image Manager</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sysinitconfig/sysinitconfig.html">Compile-Time Configuration</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sysinitdown/sysinitdown.html">System Initialization and Shutdown</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../extcmd/extcmd.html">Build-Time Hooks</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../fs/fs.html">File System</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../fcb/fcb.html">Flash Circular Buffer</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../sensor_framework/sensor_framework.html">Sensor Framework</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../testutil/testutil.html">Test Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../json/json.html">JSON</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../mfg/mfg.html">Manufacturing support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../bsp/index.html">Board support</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../network/index.html">BLE User Guide</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../newt/index.html">Newt Tool Guide</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../newtmgr/index.html">Newt Manager Guide</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../mynewt_faq/index.html">Mynewt FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../misc/index.html">Appendix</a></li> |
| </ul> |
| |
| |
| |
| </div> |
| </div> |
| </div> |
| <!-- ENDS STICKY CONTAINER --> |
| </div> |
| <!-- ENDS .container-sidebar --> |
| |
| <div class="col-xs-12 col-sm-9"> |
| |
| |
| |
| <div class=""> |
| <div class="rst-content"> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <div class="section" id="statistics-module"> |
| <h1>Statistics Module<a class="headerlink" href="#statistics-module" title="Permalink to this headline">¶</a></h1> |
| <p>The statistics module allows application, libraries, or drivers to |
| record statistics that can be shown via the Newtmgr tool and console.</p> |
| <p>This allows easy integration of statistics for troubleshooting, |
| maintenance, and usage monitoring.</p> |
| <p>By creating and registering your statistics, they are automatically |
| included in the Newtmgr shell and console APIs.</p> |
| <div class="contents local topic" id="contents"> |
| <ul class="simple"> |
| <li><p><a class="reference internal" href="#implementation-details" id="id1">Implementation Details</a></p> |
| <ul> |
| <li><p><a class="reference internal" href="#enabling-statistic-names" id="id2">Enabling Statistic Names</a></p></li> |
| </ul> |
| </li> |
| <li><p><a class="reference internal" href="#adding-stats-to-your-code" id="id3">Adding Stats to your code.</a></p> |
| <ul> |
| <li><p><a class="reference internal" href="#include-the-stats-header-file" id="id4">Include the stats header file</a></p></li> |
| <li><p><a class="reference internal" href="#define-a-stats-section" id="id5">Define a stats section</a></p></li> |
| <li><p><a class="reference internal" href="#declaring-a-variable-to-hold-the-stats" id="id6">Declaring a variable to hold the stats</a></p></li> |
| <li><p><a class="reference internal" href="#define-the-stats-section-name-table" id="id7">Define the stats section name table</a></p></li> |
| <li><p><a class="reference internal" href="#implement-stats-in-your-code" id="id8">Implement stats in your code.</a></p></li> |
| <li><p><a class="reference internal" href="#initialize-the-statistics" id="id9">Initialize the statistics</a></p></li> |
| <li><p><a class="reference internal" href="#register-the-statistic-section" id="id10">Register the statistic section</a></p></li> |
| </ul> |
| </li> |
| <li><p><a class="reference internal" href="#retrieving-stats-through-console-or-newtmgr" id="id11">Retrieving stats through console or Newtmgr</a></p></li> |
| <li><p><a class="reference internal" href="#a-note-on-multiple-stats-sections" id="id12">A note on multiple stats sections</a></p></li> |
| <li><p><a class="reference internal" href="#api" id="id13">API</a></p></li> |
| </ul> |
| </div> |
| <div class="section" id="implementation-details"> |
| <h2><a class="toc-backref" href="#id1">Implementation Details</a><a class="headerlink" href="#implementation-details" title="Permalink to this headline">¶</a></h2> |
| <p>A statistic is an unsigned integer that can be set by the code. When |
| building stats, the implementer chooses the size of the statistic |
| depending on the frequency of the statistic and the resolution required |
| before the counter wraps.</p> |
| <p>Typically the stats are incremented upon code events; however, they are |
| not limted to that purpose.</p> |
| <p>Stats are organized into sections. Each section of stats has its own |
| name and can be queried separately through the API. Each section of |
| stats also has its own statistic size, allowing the user to separate |
| large (64-bit) statistics from small (16 bit statistics). NOTE: It is |
| not currently possible to group different size stats into the same |
| section. Please ensure all stats in a section have the same size.</p> |
| <p>Stats sections are currently stored in a single global stats group.</p> |
| <p>Statistics are stored in a simple structure which contains a small stats |
| header followed by a list of stats. The stats header contains:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">struct stats_hdr {</span> |
| <span class="go"> char *s_name;</span> |
| <span class="go"> uint8_t s_size;</span> |
| <span class="go"> uint8_t s_cnt;</span> |
| <span class="go"> uint16_t s_pad1;</span> |
| <span class="gp">#</span><span class="k">if</span><span class="w"> </span>MYNEWT_VAL<span class="o">(</span>STATS_NAMES<span class="o">)</span> |
| <span class="go"> const struct stats_name_map *s_map;</span> |
| <span class="go"> int s_map_cnt;</span> |
| <span class="gp">#</span>endif |
| <span class="go"> STAILQ_ENTRY(stats_hdr) s_next;</span> |
| <span class="go"> };</span> |
| </pre></div> |
| </div> |
| <p>The fields define with in the <code class="docutils literal notranslate"><span class="pre">#if</span> <span class="pre">MYNEWT_VAL(STATS_NAME)</span></code> directive |
| are only inincluded when the <code class="docutils literal notranslate"><span class="pre">STATS_NAMES</span></code> syscfg setting is set to 1 |
| and enables use statistic names.</p> |
| <div class="section" id="enabling-statistic-names"> |
| <h3><a class="toc-backref" href="#id2">Enabling Statistic Names</a><a class="headerlink" href="#enabling-statistic-names" title="Permalink to this headline">¶</a></h3> |
| <p>By default, statistics are queried by number. You can use the |
| <code class="docutils literal notranslate"><span class="pre">STATS_NAMES</span></code> syscfg setting to enable statistic names and view the |
| results by name. Enabling statistic names provides better descriptions |
| in the reported statistics, but takes code space to store the strings |
| within the image.</p> |
| <p>To enable statistic names, set the <code class="docutils literal notranslate"><span class="pre">STATS_NAMES</span></code> value to 1 in the |
| application <code class="docutils literal notranslate"><span class="pre">syscfg.yml</span></code> file or use the <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">target</span> <span class="pre">set</span></code> command |
| to set the syscfg setting value. Here are examples for each method:</p> |
| <p>Method 1 - Set the value in the application <code class="docutils literal notranslate"><span class="pre">syscfg.yml</span></code> files:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp"># </span>Package:<span class="w"> </span>apps/myapp |
| |
| <span class="go">syscfg.vals:</span> |
| <span class="go"> STATS_NAMES: 1</span> |
| </pre></div> |
| </div> |
| <p>Method 2 - Set the target <code class="docutils literal notranslate"><span class="pre">syscfg</span></code> variable:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">newt target set myapp syscfg=STATS_NAMES=1</span> |
| </pre></div> |
| </div> |
| <p><strong>Note:</strong> This <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">target</span> <span class="pre">set</span></code> command only sets the syscfg variable |
| for the <code class="docutils literal notranslate"><span class="pre">STATS_NAMES</span></code> setting as an example. For your target, you |
| should set the syscfg variable with the other settings that you want to |
| override.</p> |
| </div> |
| </div> |
| <div class="section" id="adding-stats-to-your-code"> |
| <h2><a class="toc-backref" href="#id3">Adding Stats to your code.</a><a class="headerlink" href="#adding-stats-to-your-code" title="Permalink to this headline">¶</a></h2> |
| <p>Creating new stats table requires the following steps.</p> |
| <ul class="simple"> |
| <li><p>Include the stats header file</p></li> |
| <li><p>Define a stats section</p></li> |
| <li><p>Declare an instance of the section</p></li> |
| <li><p>Define the stat sections names table</p></li> |
| <li><p>Implement stat in your code</p></li> |
| <li><p>Initialize the stats</p></li> |
| <li><p>Register the stats</p></li> |
| </ul> |
| <div class="section" id="include-the-stats-header-file"> |
| <h3><a class="toc-backref" href="#id4">Include the stats header file</a><a class="headerlink" href="#include-the-stats-header-file" title="Permalink to this headline">¶</a></h3> |
| <p>Add the stats library to your pkg.yml file for your package or app by |
| adding this line to your package dependencies.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pkg.deps: |
| - "@apache-mynewt-core/sys/stats" |
| </pre></div> |
| </div> |
| <p>Add this include directive to code files using the stats library.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>#include <stats/stats.h> |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="define-a-stats-section"> |
| <h3><a class="toc-backref" href="#id5">Define a stats section</a><a class="headerlink" href="#define-a-stats-section" title="Permalink to this headline">¶</a></h3> |
| <p>You must use the <code class="docutils literal notranslate"><span class="pre">stats.h</span></code> macros to define your stats table. A stats |
| section definition looks like this.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>STATS_SECT_START(my_stat_section) |
| STATS_SECT_ENTRY(attempt_stat) |
| STATS_SECT_ENTRY(error_stat) |
| STATS_SECT_END |
| </pre></div> |
| </div> |
| <p>In this case we chose to make the stats 32-bits each. <code class="docutils literal notranslate"><span class="pre">stats.h</span></code> |
| supports three different stats sizes through the following macros:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">STATS_SIZE_16</span></code> – stats are 16 bits (wraps at 65536)</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">STATS_SIZE_32</span></code> – stats are 32 bits (wraps at 4294967296)</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">STATS_SIZE_64</span></code> – stats are 64-bits</p></li> |
| </ul> |
| <p>When this compiles/pre-processes, it produces a structure definition |
| like this</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct stats_my_stat_section { |
| struct stats_hdr s_hdr; |
| uint32_t sattempt_stat; |
| uint32_t serror_stat; |
| }; |
| </pre></div> |
| </div> |
| <p>You can see that the defined structure has a small stats structure |
| header and the two stats we have defined.</p> |
| <p>Depending on whether these stats are used in multiple modules, you may |
| need to include this definition in a header file.</p> |
| </div> |
| <div class="section" id="declaring-a-variable-to-hold-the-stats"> |
| <h3><a class="toc-backref" href="#id6">Declaring a variable to hold the stats</a><a class="headerlink" href="#declaring-a-variable-to-hold-the-stats" title="Permalink to this headline">¶</a></h3> |
| <p>Declare the global variable to hold your statistics. Since it is |
| possible to have multiple copies of the same section (for example a stat |
| section for each of 5 identical peripherals), the variable name of the |
| stats section must be unique.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>STATS_SECT_DECL(my_stat_section) g_mystat; |
| </pre></div> |
| </div> |
| <p>Again, if your stats section is used in multiple C files you will need |
| to include the above definition in one of the C files and ‘extern’ this |
| declaration in your header file.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>extern STATS_SECT_DECL(my_stat_section) g_mystat; |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="define-the-stats-section-name-table"> |
| <h3><a class="toc-backref" href="#id7">Define the stats section name table</a><a class="headerlink" href="#define-the-stats-section-name-table" title="Permalink to this headline">¶</a></h3> |
| <p>Whether or not you have <code class="docutils literal notranslate"><span class="pre">STATS_NAMES</span></code> enabled, you must define a stats |
| name table. If <code class="docutils literal notranslate"><span class="pre">STATS_NAMES</span></code> is not enabled, this will not take any |
| code space or image size.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>/* define a few stats for querying */ |
| STATS_NAME_START(my_stat_section) |
| STATS_NAME(my_stat_section, attempt_stat) |
| STATS_NAME(my_stat_section, error_stat) |
| STATS_NAME_END(my_stat_section) |
| </pre></div> |
| </div> |
| <p>When compiled by the preprocessor, it creates a structure that looks |
| like this.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct stats_name_map g_stats_map_my_stat_section[] = { |
| { __builtin_offsetof (struct stats_my_stat_section, sattempt_stat), "attempt_stat" }, |
| { __builtin_offsetof (struct stats_my_stat_section, serror_stat), "error_stat" }, |
| }; |
| </pre></div> |
| </div> |
| <p>This table will allow the UI components to find a nice string name for |
| the stat.</p> |
| </div> |
| <div class="section" id="implement-stats-in-your-code"> |
| <h3><a class="toc-backref" href="#id8">Implement stats in your code.</a><a class="headerlink" href="#implement-stats-in-your-code" title="Permalink to this headline">¶</a></h3> |
| <p>You can use the <code class="docutils literal notranslate"><span class="pre">STATS_INC</span></code> or <code class="docutils literal notranslate"><span class="pre">STATS_INCN</span></code> macros to increment your |
| statistics within your C-code. For example, your code may do this:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>STATS_INC(g_mystat, attempt_stat); |
| rc = do_task(); |
| if(rc == ERR) { |
| STATS_INC(g_mystat, error_stat); |
| } |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="initialize-the-statistics"> |
| <h3><a class="toc-backref" href="#id9">Initialize the statistics</a><a class="headerlink" href="#initialize-the-statistics" title="Permalink to this headline">¶</a></h3> |
| <p>You must initialize the stats so they can be operated on by the stats |
| library. As per our example above, it would look like the following.</p> |
| <p>This tells the system how large each statistic is and the number of |
| statistics in the section. It also initialize the name information for |
| the statistics if enabled as shown above.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rc = stats_init( |
| STATS_HDR(g_mystat), |
| STATS_SIZE_INIT_PARMS(g_mystat, STATS_SIZE_32), |
| STATS_NAME_INIT_PARMS(my_stat_section)); |
| assert(rc == 0); |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="register-the-statistic-section"> |
| <h3><a class="toc-backref" href="#id10">Register the statistic section</a><a class="headerlink" href="#register-the-statistic-section" title="Permalink to this headline">¶</a></h3> |
| <p>If you want the system to know about your stats, you must register them.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rc = stats_register("my_stats", STATS_HDR(g_mystat)); |
| assert(rc == 0); |
| </pre></div> |
| </div> |
| <p>There is also a method that does initialization and registration at the |
| same time, called <code class="docutils literal notranslate"><span class="pre">stats_init_and_reg</span></code>.</p> |
| </div> |
| </div> |
| <div class="section" id="retrieving-stats-through-console-or-newtmgr"> |
| <h2><a class="toc-backref" href="#id11">Retrieving stats through console or Newtmgr</a><a class="headerlink" href="#retrieving-stats-through-console-or-newtmgr" title="Permalink to this headline">¶</a></h2> |
| <p>If you enable console in your project you can see stats through the |
| serial port defined.</p> |
| <p>This is the stats as shown from the example above with names enabled.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>stat my_stats |
| 12274:attempt_stat: 3 |
| 12275:error_stat: 0 |
| </pre></div> |
| </div> |
| <p>This is the stats as shown from the example without names enabled.</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>stat my_stats |
| 29149:s0: 3 |
| 29150:s1: 0 |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="a-note-on-multiple-stats-sections"> |
| <h2><a class="toc-backref" href="#id12">A note on multiple stats sections</a><a class="headerlink" href="#a-note-on-multiple-stats-sections" title="Permalink to this headline">¶</a></h2> |
| <p>If you are implementing a device with multiple instances, you may want |
| multiple stats sections with the exact same format.</p> |
| <p>For example, suppose I write a driver for an external distance sensor. |
| My driver supports up to 5 sensors and I want to record the stats of |
| each device separately.</p> |
| <p>This works identically to the example above, except you would need to |
| register each one separately with a unique name. The stats system will |
| not let two sections be entered with the same name.</p> |
| </div> |
| <div class="section" id="api"> |
| <h2><a class="toc-backref" href="#id13">API</a><a class="headerlink" href="#api" title="Permalink to this headline">¶</a></h2> |
| <div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-defines">Defines</p> |
| <dl class="c macro"> |
| <dt id="c.STATS_HDR_F_PERSIST"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a34b4f9cc0aac0b4ef056b1f53c007bda"></span><code class="sig-name descname"><span class="pre">STATS_HDR_F_PERSIST</span></code><a class="headerlink" href="#c.STATS_HDR_F_PERSIST" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The stat group is periodically written to sys/config. </p> |
| </dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_DECL"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1aa5c058ceba0a5180975de822268493c5"></span><code class="sig-name descname"><span class="pre">STATS_SECT_DECL</span></code><span class="sig-paren">(</span><em><span class="pre">__name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SECT_DECL" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_START"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ad7161ba6f4d751488e5304bfa8fa6400"></span><code class="sig-name descname"><span class="pre">STATS_SECT_START</span></code><span class="sig-paren">(</span><em><span class="pre">__name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SECT_START" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_END"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a4124f8c0a9ffb78d8be608a780676785"></span><code class="sig-name descname"><span class="pre">STATS_SECT_END</span></code><a class="headerlink" href="#c.STATS_SECT_END" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_VAR"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ab796e75479fa88a6b5f2871ac4e8d311"></span><code class="sig-name descname"><span class="pre">STATS_SECT_VAR</span></code><span class="sig-paren">(</span><em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SECT_VAR" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_HDR"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a6e5e5af2b41530db7ca39e1792b5271c"></span><code class="sig-name descname"><span class="pre">STATS_HDR</span></code><span class="sig-paren">(</span><em><span class="pre">__sectname</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_HDR" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SIZE_16"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a6b5129b5d9a2ade6ecfd011ad2c4377f"></span><code class="sig-name descname"><span class="pre">STATS_SIZE_16</span></code><a class="headerlink" href="#c.STATS_SIZE_16" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SIZE_32"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a68323f9fddd985e9042bdca5b7f830b5"></span><code class="sig-name descname"><span class="pre">STATS_SIZE_32</span></code><a class="headerlink" href="#c.STATS_SIZE_32" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SIZE_64"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1afc9977fb100d17785440abf9cb93e63d"></span><code class="sig-name descname"><span class="pre">STATS_SIZE_64</span></code><a class="headerlink" href="#c.STATS_SIZE_64" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_ENTRY"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a0107ed049bdfec5f81e89565bf8d9581"></span><code class="sig-name descname"><span class="pre">STATS_SECT_ENTRY</span></code><span class="sig-paren">(</span><em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SECT_ENTRY" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_ENTRY16"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a722e42372a1d435810e0358320b49ef4"></span><code class="sig-name descname"><span class="pre">STATS_SECT_ENTRY16</span></code><span class="sig-paren">(</span><em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SECT_ENTRY16" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_ENTRY32"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a4e0e5519c6bbbb80e54d95904d3b9a34"></span><code class="sig-name descname"><span class="pre">STATS_SECT_ENTRY32</span></code><span class="sig-paren">(</span><em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SECT_ENTRY32" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SECT_ENTRY64"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a57461bef0e0f9d35f04d264212ad95e2"></span><code class="sig-name descname"><span class="pre">STATS_SECT_ENTRY64</span></code><span class="sig-paren">(</span><em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SECT_ENTRY64" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_RESET"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ab2f77e7b2c1d6c10a148a365f14e51b1"></span><code class="sig-name descname"><span class="pre">STATS_RESET</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_RESET" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Resets all stats in the provided group to 0. </p> |
| <p>NOTE: This must only be used with non-persistent stat groups. </p> |
| </dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SIZE_INIT_PARMS"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1aeba9abbe58f69f69f673de1405b1ee19"></span><code class="sig-name descname"><span class="pre">STATS_SIZE_INIT_PARMS</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__size</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SIZE_INIT_PARMS" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_GET"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ad48adbf13eba26d6b819df7a886569fd"></span><code class="sig-name descname"><span class="pre">STATS_GET</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_GET" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SET_RAW"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1afe18f762fcc557581af89728b7c2257e"></span><code class="sig-name descname"><span class="pre">STATS_SET_RAW</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em>, <em><span class="pre">__val</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SET_RAW" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_SET"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ab38d70a4bbc964764268332446e3fd3f"></span><code class="sig-name descname"><span class="pre">STATS_SET</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em>, <em><span class="pre">__val</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_SET" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_INCN_RAW"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ab9d900b795df7d371df46cc6aba48792"></span><code class="sig-name descname"><span class="pre">STATS_INCN_RAW</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em>, <em><span class="pre">__n</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_INCN_RAW" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adjusts a stat’s in-RAM value by the specified delta. </p> |
| <p>For non-persistent stats, this is more efficient than <code class="docutils literal notranslate"><a class="reference internal" href="#full_2include_2stats_2stats_8h_1ab05fd26106af935e42ac6267b5715b62"><span class="std std-ref"><span class="pre">STATS_INCN()</span></span></a></code>. This must only be used with non-persistent stats; for persistent stats the behavior is undefined.</p> |
| <p><dl class="simple"> |
| <dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__sectvarname</span></code>: The name of the stat group containing the stat to modify. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__var</span></code>: The name of the individual stat to modify. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__n</span></code>: The amount to add to the specified stat. </p></li> |
| </ul> |
| </dd> |
| </dl> |
| </p> |
| </dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_INC_RAW"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a8526d4cb99c97195d714d2376af1b283"></span><code class="sig-name descname"><span class="pre">STATS_INC_RAW</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_INC_RAW" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Increments a stat’s in-RAM value. </p> |
| <p>For non-persistent stats, this is more efficient than <code class="docutils literal notranslate"><a class="reference internal" href="#full_2include_2stats_2stats_8h_1ab05fd26106af935e42ac6267b5715b62"><span class="std std-ref"><span class="pre">STATS_INCN()</span></span></a></code>. This must only be used with non-persistent stats; for persistent stats the behavior is undefined.</p> |
| <p><dl class="simple"> |
| <dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__sectvarname</span></code>: The name of the stat group containing the stat to modify. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__var</span></code>: The name of the individual stat to modify. </p></li> |
| </ul> |
| </dd> |
| </dl> |
| </p> |
| </dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_INCN"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ab05fd26106af935e42ac6267b5715b62"></span><code class="sig-name descname"><span class="pre">STATS_INCN</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em>, <em><span class="pre">__n</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_INCN" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adjusts a stat’s value by the specified delta. </p> |
| <p>If the specified stat group is persistent, this also schedules the group to be flushed to disk.</p> |
| <p><dl class="simple"> |
| <dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__sectvarname</span></code>: The name of the stat group containing the stat to modify. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__var</span></code>: The name of the individual stat to modify. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__n</span></code>: The amount to add to the specified stat. </p></li> |
| </ul> |
| </dd> |
| </dl> |
| </p> |
| </dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_INC"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a69ea85cb340bc36eec309a0a06a1216c"></span><code class="sig-name descname"><span class="pre">STATS_INC</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_INC" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Increments a stat’s value. </p> |
| <p>If the specified stat group is persistent, this also schedules the group to be flushed to disk.</p> |
| <p><dl class="simple"> |
| <dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__sectvarname</span></code>: The name of the stat group containing the stat to modify. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">__var</span></code>: The name of the individual stat to modify. </p></li> |
| </ul> |
| </dd> |
| </dl> |
| </p> |
| </dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_CLEAR"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a3a11e1c239d38e29328a0e71f0cf3279"></span><code class="sig-name descname"><span class="pre">STATS_CLEAR</span></code><span class="sig-paren">(</span><em><span class="pre">__sectvarname</span></em>, <em><span class="pre">__var</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_CLEAR" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_NAME_MAP_NAME"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ac173a1d796bca20ad035cda720d51091"></span><code class="sig-name descname"><span class="pre">STATS_NAME_MAP_NAME</span></code><span class="sig-paren">(</span><em><span class="pre">__sectname</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_NAME_MAP_NAME" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_NAME_START"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1af4ba655b5edff49b2c949a06ce90c2b4"></span><code class="sig-name descname"><span class="pre">STATS_NAME_START</span></code><span class="sig-paren">(</span><em><span class="pre">__sectname</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_NAME_START" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_NAME"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ae77d426ff47e2e22523df582026dd83b"></span><code class="sig-name descname"><span class="pre">STATS_NAME</span></code><span class="sig-paren">(</span><em><span class="pre">__sectname</span></em>, <em><span class="pre">__entry</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_NAME" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_NAME_END"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a2aa46b18009fe7df1ac373616f95e19a"></span><code class="sig-name descname"><span class="pre">STATS_NAME_END</span></code><span class="sig-paren">(</span><em><span class="pre">__sectname</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_NAME_END" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_NAME_INIT_PARMS"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1afff3f3df58f43542c81f3b2b0b2f85b5"></span><code class="sig-name descname"><span class="pre">STATS_NAME_INIT_PARMS</span></code><span class="sig-paren">(</span><em><span class="pre">__name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_NAME_INIT_PARMS" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_PERSISTED_SECT_START"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a6e58668e77f8419f175403d57b5502e2"></span><code class="sig-name descname"><span class="pre">STATS_PERSISTED_SECT_START</span></code><span class="sig-paren">(</span><em><span class="pre">__name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_PERSISTED_SECT_START" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Starts the definition of a peristed stat group. </p> |
| <p>o Follow with invocations of the <code class="docutils literal notranslate"><span class="pre">STATS_SECT_ENTRY[...]</span></code> macros to define individual stats. o Use <code class="docutils literal notranslate"><span class="pre">STATS_SECT_END</span></code> to complete the group definition. </p> |
| </dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_PERSISTED_HDR"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a80437f81dd8c9836aa75cb9b029fde6e"></span><code class="sig-name descname"><span class="pre">STATS_PERSISTED_HDR</span></code><span class="sig-paren">(</span><em><span class="pre">__sectname</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_PERSISTED_HDR" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c macro"> |
| <dt id="c.STATS_PERSIST_SCHED"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a3faf05b5b5cea4d88344f9ce689c4cc2"></span><code class="sig-name descname"><span class="pre">STATS_PERSIST_SCHED</span></code><span class="sig-paren">(</span><em><span class="pre">hdrp_</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.STATS_PERSIST_SCHED" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>(private) Starts the provided stat group’s persistence timer if it is a persistent group. </p> |
| <p>This should be used whenever a statistic’s value changes. This is a no-op for non-persistent stat groups. </p> |
| </dd></dl> |
| |
| </div> |
| <div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-typedefs">Typedefs</p> |
| <dl class="c type"> |
| <dt id="c.stats_walk_func_t"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a113d03d0839102b6adc088e781236647"></span><em class="property"><span class="pre">typedef</span> </em><span class="pre">int</span> <span class="pre">(</span><span class="pre">*</span><code class="sig-name descname"><span class="pre">stats_walk_func_t</span></code><span class="pre">)</span><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a><span class="pre">*</span>, <span class="pre">void</span><span class="pre">*</span>, <span class="pre">char</span><span class="pre">*</span>, <span class="pre">uint16_t</span><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_walk_func_t" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c type"> |
| <dt id="c.stats_group_walk_func_t"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a0935f4cdba4d879dfbaa0884f7c34837"></span><em class="property"><span class="pre">typedef</span> </em><span class="pre">int</span> <span class="pre">(</span><span class="pre">*</span><code class="sig-name descname"><span class="pre">stats_group_walk_func_t</span></code><span class="pre">)</span><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a><span class="pre">*</span>, <span class="pre">void</span><span class="pre">*</span><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_group_walk_func_t" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| </div> |
| <div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-functions">Functions</p> |
| <dl class="c function"> |
| <dt> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ace51921eda4c37ef768c1ebc6a070831"></span><code class="sig-name descname"><span class="pre">STAILQ_HEAD</span> <span class="pre">(stats_registry_list,</span> <span class="pre">stats_hdr)</span></code></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_init"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1aa37530f6293a5e6b7d4bdd0b087d21d6"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_init</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <span class="pre">*</span><em><span class="pre">shdr</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">size</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">cnt</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_name_map" title="stats_name_map"><span class="pre">stats_name_map</span></a> <span class="pre">*</span><em><span class="pre">map</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">map_cnt</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_init" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_register"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a0a26d63646d1157509afcc370738b9d8"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_register</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">name</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <span class="pre">*</span><em><span class="pre">shdr</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_register" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_init_and_reg"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a21b70af7734f9043c8d4760805c5280d"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_init_and_reg</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <span class="pre">*</span><em><span class="pre">shdr</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">size</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">cnt</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_name_map" title="stats_name_map"><span class="pre">stats_name_map</span></a> <span class="pre">*</span><em><span class="pre">map</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">map_cnt</span></em>, <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_init_and_reg" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_reset"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1aca8e338b464a6c317232d7029c80f206"></span><span class="pre">void</span> <code class="sig-name descname"><span class="pre">stats_reset</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <span class="pre">*</span><em><span class="pre">shdr</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_reset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_walk"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1ad695b011d21c10aaba18b49330fcd49b"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_walk</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a><span class="pre">*</span>, <a class="reference internal" href="#c.stats_walk_func_t" title="stats_walk_func_t"><span class="pre">stats_walk_func_t</span></a>, <span class="pre">void</span><span class="pre">*</span><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_walk" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_group_walk"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a28e08ca13c18db851525b32cb462e1d0"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_group_walk</span></code><span class="sig-paren">(</span><a class="reference internal" href="#c.stats_group_walk_func_t" title="stats_group_walk_func_t"><span class="pre">stats_group_walk_func_t</span></a>, <span class="pre">void</span><span class="pre">*</span><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_group_walk" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_group_find"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a9880b91ecc298294c107e5f3e46bc7bc"></span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <span class="pre">*</span><code class="sig-name descname"><span class="pre">stats_group_find</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_group_find" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_mgmt_register_group"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a3aa868e38f62a7ef5e87f603947eb786"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_mgmt_register_group</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_mgmt_register_group" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_shell_register"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a82d03ce983e0ee39dbd992c2bf0e617a"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_shell_register</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_shell_register" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_persist_sched"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a8aceffcbc371d276820546529d00095b"></span><span class="pre">void</span> <code class="sig-name descname"><span class="pre">stats_persist_sched</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <span class="pre">*</span><em><span class="pre">hdr</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_persist_sched" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>(private) Starts the provided stat group’s persistence timer. </p> |
| <p>This should be used whenever a statistic’s value changes. This is a no-op for non-persistent stat groups. </p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_persist_flush"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a2d9056f2cb3014344aee8ea703a39924"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_persist_flush</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_persist_flush" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Flushes to disk all persisted stat groups with pending writes. </p> |
| <p><dl class="simple"> |
| <dt><strong>Return</strong></dt><dd><p>0 on success; nonzero on failure. </p> |
| </dd> |
| </dl> |
| </p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.stats_persist_init"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a3a3a84934ceda53181c82fdec1d35b1d"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">stats_persist_init</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <span class="pre">*</span><em><span class="pre">hdr</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">size</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">cnt</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_name_map" title="stats_name_map"><span class="pre">stats_name_map</span></a> <span class="pre">*</span><em><span class="pre">map</span></em>, <span class="pre">uint8_t</span> <em><span class="pre">map_cnt</span></em>, <a class="reference internal" href="../../core_os/time/os_time.html#c.os_time_t" title="os_time_t"><span class="pre">os_time_t</span></a> <em><span class="pre">persist_delay</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.stats_persist_init" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Initializes a persistent stat group. </p> |
| <p>This function must be called before any other stats API functions are applied to the specified stat group. This is typically done during system startup.</p> |
| <p>Example usage: <a class="reference internal" href="#full_2include_2stats_2stats_8h_1a6e58668e77f8419f175403d57b5502e2"><span class="std std-ref">STATS_PERSISTED_SECT_START(my_stats)</span></a> <a class="reference internal" href="#full_2include_2stats_2stats_8h_1a0107ed049bdfec5f81e89565bf8d9581"><span class="std std-ref">STATS_SECT_ENTRY(stat1)</span></a> <a class="reference internal" href="#full_2include_2stats_2stats_8h_1a4124f8c0a9ffb78d8be608a780676785"><span class="std std-ref">STATS_SECT_END(my_stats)</span></a></p> |
| <p><a class="reference internal" href="#full_2include_2stats_2stats_8h_1af4ba655b5edff49b2c949a06ce90c2b4"><span class="std std-ref">STATS_NAME_START(my_stats)</span></a> <a class="reference internal" href="#full_2include_2stats_2stats_8h_1a0107ed049bdfec5f81e89565bf8d9581"><span class="std std-ref">STATS_SECT_ENTRY(my_stats, stat1)</span></a> <a class="reference internal" href="#full_2include_2stats_2stats_8h_1a2aa46b18009fe7df1ac373616f95e19a"><span class="std std-ref">STATS_NAME_END(my_stats)</span></a></p> |
| <p>rc = stats_persist_init(<a class="reference internal" href="#full_2include_2stats_2stats_8h_1a80437f81dd8c9836aa75cb9b029fde6e"><span class="std std-ref">STATS_PERSISTED_HDR(my_stats)</span></a>, <a class="reference internal" href="#full_2include_2stats_2stats_8h_1aeba9abbe58f69f69f673de1405b1ee19"><span class="std std-ref">STATS_SIZE_INIT_PARMS(my_stats, STATS_SIZE_32)</span></a>, <a class="reference internal" href="#full_2include_2stats_2stats_8h_1afff3f3df58f43542c81f3b2b0b2f85b5"><span class="std std-ref">STATS_NAME_INIT_PARMS(my_stats)</span></a>, 1 * OS_TICKS_PER_SEC); // One second.</p> |
| <p><dl class="simple"> |
| <dt><strong>Return</strong></dt><dd><p>0 on success; nonzero on failure. </p> |
| </dd> |
| <dt><strong>Parameters</strong></dt><dd><ul class="breatheparameterlist simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">hdr</span></code>: The header of the stat group to initialize. Use the <code class="docutils literal notranslate"><a class="reference internal" href="#full_2include_2stats_2stats_8h_1a80437f81dd8c9836aa75cb9b029fde6e"><span class="std std-ref"><span class="pre">STATS_PERSISTED_HDR()</span></span></a></code> macro to generate this argument. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">size</span></code>: The size, in bytes, of each statistic. Use the <code class="docutils literal notranslate"><a class="reference internal" href="#full_2include_2stats_2stats_8h_1aeba9abbe58f69f69f673de1405b1ee19"><span class="std std-ref"><span class="pre">STATS_SIZE_INIT_PARMS()</span></span></a></code> macro to generate this and the <code class="docutils literal notranslate"><span class="pre">cnt</span></code> arguments. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">cnt</span></code>: The number of statistics in the group. Use the <code class="docutils literal notranslate"><a class="reference internal" href="#full_2include_2stats_2stats_8h_1aeba9abbe58f69f69f673de1405b1ee19"><span class="std std-ref"><span class="pre">STATS_SIZE_INIT_PARMS()</span></span></a></code> macro to generate this and the <code class="docutils literal notranslate"><span class="pre">size</span></code> arguments. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">map</span></code>: Maps each stat to a human-readable name. Use the <code class="docutils literal notranslate"><a class="reference internal" href="#full_2include_2stats_2stats_8h_1afff3f3df58f43542c81f3b2b0b2f85b5"><span class="std std-ref"><span class="pre">STATS_NAME_INIT_PARMS()</span></span></a></code> macro to generate this and the <code class="docutils literal notranslate"><span class="pre">map_cnt</span></code> arguments. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">map_cnt</span></code>: The number of names in <code class="docutils literal notranslate"><span class="pre">map.</span> <span class="pre">Use</span> <span class="pre">the</span> <span class="pre">the</span> </code><a class="reference internal" href="#full_2include_2stats_2stats_8h_1afff3f3df58f43542c81f3b2b0b2f85b5"><span class="std std-ref">STATS_NAME_INIT_PARMS()</span></a><code class="docutils literal notranslate"><span class="pre">macro</span> <span class="pre">to</span> <span class="pre">generate</span> <span class="pre">this</span> <span class="pre">and</span> <span class="pre">the</span></code>map` arguments. </p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">persist_delay</span></code>: The delay, in OS ticks, before the stat group is flushed to disk after modification.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </p> |
| </dd></dl> |
| |
| </div> |
| <div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-variables">Variables</p> |
| <dl class="c var"> |
| <dt id="c.g_stats_registry"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1adef295b10986426cfb64d3630e1053a7"></span><em class="property"><span class="pre">struct</span></em> <span class="pre">stats_registry_list</span> <code class="sig-name descname"><span class="pre">g_stats_registry</span></code><a class="headerlink" href="#c.g_stats_registry" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.snm_off"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1aa31e268e12fb19003bd987c634af9805"></span><span class="pre">uint16_t</span> <code class="sig-name descname"><span class="pre">snm_off</span></code><a class="headerlink" href="#c.snm_off" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.snm_name"> |
| <span class="target" id="full_2include_2stats_2stats_8h_1a1417af12d523324dd00e1aa10bfde2bc"></span><span class="pre">char</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">snm_name</span></code><a class="headerlink" href="#c.snm_name" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| </div> |
| <dl class="c struct"> |
| <dt id="c.stats_name_map"> |
| <span class="target" id="structstats__name__map"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">stats_name_map</span></code><a class="headerlink" href="#c.stats_name_map" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><em>#include <stats.h></em><div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p> |
| <dl class="c var"> |
| <dt id="c.stats_name_map.snm_off"> |
| <span class="target" id="structstats__name__map_1aa7f6799c19e062f267d5061bcd9eb420"></span><span class="pre">uint16_t</span> <code class="sig-name descname"><span class="pre">snm_off</span></code><a class="headerlink" href="#c.stats_name_map.snm_off" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_name_map.snm_name"> |
| <span class="target" id="structstats__name__map_1a3aa820f06201e24f139429dfe62a74fa"></span><span class="pre">char</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">snm_name</span></code><a class="headerlink" href="#c.stats_name_map.snm_name" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| </div> |
| </dd></dl> |
| |
| <dl class="c struct"> |
| <dt id="c.stats_hdr"> |
| <span class="target" id="structstats__hdr"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">stats_hdr</span></code><a class="headerlink" href="#c.stats_hdr" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><em>#include <stats.h></em><div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-functions">Public Functions</p> |
| <dl class="c function"> |
| <dt> |
| <span class="target" id="structstats__hdr_1a3cd05b84ec8f05347a476de41b084f5e"></span><code class="sig-name descname"><span class="pre">STAILQ_ENTRY</span> <span class="pre">(stats_hdr)</span> <span class="pre">s_next</span></code></dt> |
| <dd></dd></dl> |
| |
| </div> |
| <div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p> |
| <dl class="c var"> |
| <dt id="c.stats_hdr.s_name"> |
| <span class="target" id="structstats__hdr_1ae693a2eb179e1f48c77296ea7515a36b"></span><em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><code class="sig-name descname"><span class="pre">s_name</span></code><a class="headerlink" href="#c.stats_hdr.s_name" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_hdr.s_size"> |
| <span class="target" id="structstats__hdr_1a0fd7b023184a4179a48fa51d86472ac6"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">s_size</span></code><a class="headerlink" href="#c.stats_hdr.s_size" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_hdr.s_cnt"> |
| <span class="target" id="structstats__hdr_1ac7eda2abda7d0fd1336a9cd2fd1d40f9"></span><span class="pre">uint8_t</span> <code class="sig-name descname"><span class="pre">s_cnt</span></code><a class="headerlink" href="#c.stats_hdr.s_cnt" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_hdr.s_flags"> |
| <span class="target" id="structstats__hdr_1afeb154d6e596f19970bab05d2a2e4a9a"></span><span class="pre">uint16_t</span> <code class="sig-name descname"><span class="pre">s_flags</span></code><a class="headerlink" href="#c.stats_hdr.s_flags" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_hdr.s_map"> |
| <span class="target" id="structstats__hdr_1a061f406127cd0b1fa657ae856ecd50d3"></span><em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_name_map" title="stats_name_map"><span class="pre">stats_name_map</span></a> <span class="pre">*</span><code class="sig-name descname"><span class="pre">s_map</span></code><a class="headerlink" href="#c.stats_hdr.s_map" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_hdr.s_map_cnt"> |
| <span class="target" id="structstats__hdr_1a6986cd5953b220fcb714b1486b9d877d"></span><span class="pre">int</span> <code class="sig-name descname"><span class="pre">s_map_cnt</span></code><a class="headerlink" href="#c.stats_hdr.s_map_cnt" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| </div> |
| </dd></dl> |
| |
| <dl class="c struct"> |
| <dt id="c.stats_persisted_hdr"> |
| <span class="target" id="structstats__persisted__hdr"></span><em class="property"><span class="pre">struct</span> </em><code class="sig-name descname"><span class="pre">stats_persisted_hdr</span></code><a class="headerlink" href="#c.stats_persisted_hdr" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><em>#include <stats.h></em><p>Header describing a persistent stat group. </p> |
| <p>A pointer to a regular <code class="docutils literal notranslate"><a class="reference internal" href="#structstats__hdr"><span class="std std-ref"><span class="pre">stats_hdr</span></span></a></code> can be safely cast to a pointer to <code class="docutils literal notranslate"><a class="reference internal" href="#structstats__persisted__hdr"><span class="std std-ref"><span class="pre">stats_persisted_hdr</span></span></a></code> (and vice-versa) if the <code class="docutils literal notranslate"><span class="pre">STATS_HDR_F_PERSIST</span></code> flag is set. </p> |
| <div class="breathe-sectiondef docutils container"> |
| <p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p> |
| <dl class="c var"> |
| <dt id="c.stats_persisted_hdr.sp_hdr"> |
| <span class="target" id="structstats__persisted__hdr_1acb1797e1e503639741cb0a57b90a7e39"></span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.stats_hdr" title="stats_hdr"><span class="pre">stats_hdr</span></a> <code class="sig-name descname"><span class="pre">sp_hdr</span></code><a class="headerlink" href="#c.stats_persisted_hdr.sp_hdr" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_persisted_hdr.sp_persist_timer"> |
| <span class="target" id="structstats__persisted__hdr_1abe0294de3ed5a4d17a2686b58eae98b0"></span><em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="../../core_os/callout/callout.html#c.os_callout" title="os_callout"><span class="pre">os_callout</span></a> <code class="sig-name descname"><span class="pre">sp_persist_timer</span></code><a class="headerlink" href="#c.stats_persisted_hdr.sp_persist_timer" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c var"> |
| <dt id="c.stats_persisted_hdr.sp_persist_delay"> |
| <span class="target" id="structstats__persisted__hdr_1ac1c7e3c3562980cdd121d357177eb226"></span><a class="reference internal" href="../../core_os/time/os_time.html#c.os_time_t" title="os_time_t"><span class="pre">os_time_t</span></a> <code class="sig-name descname"><span class="pre">sp_persist_delay</span></code><a class="headerlink" href="#c.stats_persisted_hdr.sp_persist_delay" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| </div> |
| </dd></dl> |
| |
| </div> |
| </div> |
| |
| |
| </div> |
| </div> |
| |
| <div class="rst-footer-buttons row" role="navigation" aria-label="footer navigation"> |
| |
| <a href="../console/console.html" class="btn btn-neutral float-right" title="Console" accesskey="n">Next: Console <span class="fa fa-arrow-circle-right"></span></a> |
| |
| |
| <a href="../logs/logs.html" class="btn btn-neutral" title="Logging" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous: Logging</a> |
| |
| </div> |
| |
| </div> |
| </div> |
| </div> |
| <!-- ENDS CONTENT SECTION --> |
| </div> |
| <!-- ENDS .content --> |
| </div> |
| </div> |
| <footer> |
| <div class="container"> |
| <div class="row"> |
| <div class="col-xs-12"> |
| |
| <p class="copyright">Apache Mynewt is available under Apache License, version 2.0.</p> |
| |
| </div> |
| <div class="col-xs-12"> |
| <div class="logos"> |
| <img src="../../../_static/img/asf_logo_wide_small.png" alt="Apache" title="Apache"> |
| <small class="footnote"> |
| Apache Mynewt, Mynewt, Apache, the Apache feather logo, and the Apache Mynewt project logo are either |
| registered trademarks or trademarks of the Apache Software Foundation in the United States and other countries. |
| </small> |
| <a href=""> |
| <img src="../../../_static/img/add_to_slack.png" alt="Slack Icon" title="Join our Slack Community" /> |
| </a> |
| </div> |
| </div> |
| </div> |
| </div> |
| </footer> |
| </div> |
| <!-- ENDS #wrapper --> |
| |
| |
| |
| <script type="text/javascript"> |
| var DOCUMENTATION_OPTIONS = { |
| URL_ROOT:'../../../', |
| VERSION:'latest', |
| COLLAPSE_INDEX:false, |
| FILE_SUFFIX:'.html', |
| HAS_SOURCE: true, |
| SOURCELINK_SUFFIX: '.txt', |
| LINK_SUFFIX: '.html' |
| }; |
| </script> |
| <script type="text/javascript" src="../../../_static/jquery.js"></script> |
| <script type="text/javascript" src="../../../_static/underscore.js"></script> |
| <script type="text/javascript" src="../../../_static/doctools.js"></script> |
| <script type="text/javascript" src="../../../_static/js/bootstrap-3.0.3.min.js"></script> |
| <script type="text/javascript" src="../../../_static/js/affix.js"></script> |
| <script type="text/javascript" src="../../../_static/js/main.js"></script> |
| |
| |
| |
| </body> |
| </html> |