[ 
https://issues.apache.org/jira/browse/MYNEWT-1?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sterling Hughes resolved MYNEWT-1.
----------------------------------
    Resolution: Fixed

There is a stats API in sys/stats/.  The stats API works as such: 

Statistics are declared as: 

STATS_SECT_START(stats)
    STATS_SECT_ENTRY(num_registered)
STATS_SECT_END(stats)

STATS_NAME_START(stats)
    STATS_NAME(stats, num_registered)
STATS_NAME_END(stats)

These statistics can then be registered using the stats_register() function: 
    rc = stats_register("stat", STATS_HDR(stats));
    if (rc != 0) {
        goto err;
    }

If the define -DSTATS_NAME_ENABLE is specified at the project level, then the 
statistics name (e.g. num_registered) is stored along with the statistics, and 
can be return either by the console/shell or by newtmgr.

If not, each statistic is labeled by its order of declaration in the structure, 
so  "num_registered" would be represented by "s0".  This is to avoid adding 
code space (text strings) by default.   

We eventually need some sort of parser, that can take statistics order and 
strings, and make them a part of the build manifest.  That way, for a given 
build, you can have a description of what s0, etc mean, and match that up after 
the fact with the pretty names.  



> Implement statistics interface
> ------------------------------
>
>                 Key: MYNEWT-1
>                 URL: https://issues.apache.org/jira/browse/MYNEWT-1
>             Project: Mynewt
>          Issue Type: New Feature
>            Reporter: Sterling Hughes
>            Assignee: Sterling Hughes
>
> The system should have a unified way of keeping statistics and logging 
> messages.  
> The statistics interface should allow you to declare a structure of 32-bit or 
> 64-bit counters that are recorded.
> struct STAT(os) {
>   STAT_ENTRY32(ctxsw_count)
>   STAT_ENTRY64(nrinterrupts)
> }; 
> These statistics entries should be registered with the system, and there 
> should be both debugger APIs and APIs to fetch the statistics over the 
> console.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to