Skip to content
Permalink
Browse files

stats: extending api to handle statistics with more than 256 elements

Changed type of the paramater that determines the number of elements in
the stats group. Now it is possible to declared more than 256 elements.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
  • Loading branch information...
kapi-no authored and nashif committed Apr 18, 2019
1 parent ec2f503 commit 0a8c75f96eb3600b0a485d25a22ed97790d07a36
Showing with 10 additions and 10 deletions.
  1. +6 −6 include/stats.h
  2. +4 −4 subsys/stats/stats.c
@@ -66,8 +66,8 @@ struct stats_name_map {
struct stats_hdr {
const char *s_name;
u8_t s_size;
u8_t s_cnt;
u16_t s_pad1;
u16_t s_cnt;
u8_t s_pad1;
#ifdef CONFIG_STATS_NAMES
const struct stats_name_map *s_map;
int s_map_cnt;
@@ -214,8 +214,8 @@ struct stats_hdr {
* @param group__ The group containing the entry to clear.
* @param var__ The statistic entry to clear.
*/
void stats_init(struct stats_hdr *shdr, uint8_t size, uint8_t cnt,
const struct stats_name_map *map, uint8_t map_cnt);
void stats_init(struct stats_hdr *shdr, uint8_t size, uint16_t cnt,
const struct stats_name_map *map, uint16_t map_cnt);

/**
* @brief Registers a statistics group to be managed.
@@ -255,8 +255,8 @@ int stats_register(const char *name, struct stats_hdr *shdr);
*
* @see STATS_INIT_AND_REG
*/
int stats_init_and_reg(struct stats_hdr *hdr, uint8_t size, uint8_t cnt,
const struct stats_name_map *map, uint8_t map_cnt,
int stats_init_and_reg(struct stats_hdr *hdr, uint8_t size, uint16_t cnt,
const struct stats_name_map *map, uint16_t map_cnt,
const char *name);

/**
@@ -131,8 +131,8 @@ stats_walk(struct stats_hdr *hdr, stats_walk_fn *walk_func, void *arg)
* @param map_cnt The number of items in the statistics map
*/
void
stats_init(struct stats_hdr *hdr, u8_t size, u8_t cnt,
const struct stats_name_map *map, u8_t map_cnt)
stats_init(struct stats_hdr *hdr, u8_t size, u16_t cnt,
const struct stats_name_map *map, u16_t map_cnt)
{
hdr->s_size = size;
hdr->s_cnt = cnt;
@@ -257,8 +257,8 @@ stats_register(const char *name, struct stats_hdr *hdr)
* @return 0 on success, non-zero error code on failure.
*/
int
stats_init_and_reg(struct stats_hdr *shdr, u8_t size, u8_t cnt,
const struct stats_name_map *map, u8_t map_cnt,
stats_init_and_reg(struct stats_hdr *shdr, u8_t size, u16_t cnt,
const struct stats_name_map *map, u16_t map_cnt,
const char *name)
{
int rc;

0 comments on commit 0a8c75f

Please sign in to comment.
You can’t perform that action at this time.