build_stats()

build_stats()#

build_stats() constructs a JSON object containing statistical data extracted from the attributes of a given hgobj instance, including attributes marked with SFD_STATS flags.

Prototype

json_t *build_stats(
    hgobj      gobj,
    const char *stats,
    json_t     *kw,
    hgobj      src
);

Parameters

Key

Type

Description

gobj

hgobj

The hgobj instance from which statistics are gathered.

stats

const char *

A string specifying which statistics to include. If "__reset__", resets the statistics.

kw

json_t *

A JSON object containing additional parameters. This object is decremented after use.

src

hgobj

The source hgobj instance, used for context in the statistics gathering process.


Return Value

A JSON object containing the collected statistics, structured by the short names of the hgobj instances.

Notes

Internally, _build_stats() is used to extract statistics from the hgobj instance and its bottom-level objects. The function iterates through the hierarchy of hgobj instances, aggregating statistics from each level.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples