You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2017/01/18 00:20:04 UTC
[03/10] incubator-mynewt-core git commit: sys/stats;
add STATS_RESET() to clear counter area from stats structure.
sys/stats; add STATS_RESET() to clear counter area from stats structure.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f89dd346
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f89dd346
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f89dd346
Branch: refs/heads/develop
Commit: f89dd34602d49dcdb1de8bfcd2b81a77d2ef0982
Parents: 002424b
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Jan 17 14:29:21 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Jan 17 14:29:21 2017 -0800
----------------------------------------------------------------------
net/nimble/controller/src/ble_ll.c | 3 +--
net/nimble/controller/src/ble_ll_conn.c | 3 +--
sys/stats/full/include/stats/stats.h | 4 +++-
3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f89dd346/net/nimble/controller/src/ble_ll.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll.c b/net/nimble/controller/src/ble_ll.c
index 81cd148..40f4f17 100644
--- a/net/nimble/controller/src/ble_ll.c
+++ b/net/nimble/controller/src/ble_ll.c
@@ -1151,8 +1151,7 @@ ble_ll_reset(void)
ble_ll_flush_pkt_queue(&g_ble_ll_data.ll_rx_pkt_q);
/* Reset LL stats */
- memset((uint8_t *)&ble_ll_stats + sizeof(struct stats_hdr), 0,
- sizeof(struct stats_ble_ll_stats) - sizeof(struct stats_hdr));
+ STATS_RESET(ble_ll_stats);
#ifdef BLE_LL_LOG
g_ble_ll_log_index = 0;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f89dd346/net/nimble/controller/src/ble_ll_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn.c b/net/nimble/controller/src/ble_ll_conn.c
index a0a712c..db8f863 100644
--- a/net/nimble/controller/src/ble_ll_conn.c
+++ b/net/nimble/controller/src/ble_ll_conn.c
@@ -3215,8 +3215,7 @@ ble_ll_conn_module_reset(void)
conn_params->master_chan_map[4] = 0x1f;
/* Reset statistics */
- memset((uint8_t *)&ble_ll_conn_stats + sizeof(struct stats_hdr), 0,
- sizeof(struct stats_ble_ll_conn_stats) - sizeof(struct stats_hdr));
+ STATS_RESET(ble_ll_conn_stats);
}
/* Initialize the connection module */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f89dd346/sys/stats/full/include/stats/stats.h
----------------------------------------------------------------------
diff --git a/sys/stats/full/include/stats/stats.h b/sys/stats/full/include/stats/stats.h
index f7bb5f8..1f381f1 100644
--- a/sys/stats/full/include/stats/stats.h
+++ b/sys/stats/full/include/stats/stats.h
@@ -66,6 +66,9 @@ STATS_SECT_DECL(__name) { \
#define STATS_SECT_ENTRY16(__var) uint16_t STATS_SECT_VAR(__var);
#define STATS_SECT_ENTRY32(__var) uint32_t STATS_SECT_VAR(__var);
#define STATS_SECT_ENTRY64(__var) uint64_t STATS_SECT_VAR(__var);
+#define STATS_RESET(__var) \
+ memset((uint8_t *)&__var + sizeof(struct stats_hdr), 0, \
+ sizeof(__var) - sizeof(struct stats_hdr))
#define STATS_SIZE_INIT_PARMS(__sectvarname, __size) \
(__size), \
@@ -107,7 +110,6 @@ const struct stats_name_map STATS_NAME_MAP_NAME(__sectname)[] = {
#endif /* MYNEWT_VAL(STATS_NAME) */
-void stats_module_init(void);
int stats_init(struct stats_hdr *shdr, uint8_t size, uint8_t cnt,
const struct stats_name_map *map, uint8_t map_cnt);
int stats_register(char *name, struct stats_hdr *shdr);