diff options
| author | Qiuwen Lu <[email protected]> | 2017-10-31 12:53:09 +0800 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2017-10-31 12:53:09 +0800 |
| commit | 3b1b53e49d84a42132e6f502ba900b59e56ea657 (patch) | |
| tree | 9102dfa63b60e0f12f7fde223a62e549affb222e /app/src/monit.c | |
| parent | 6e59c3209be1b7a6a8ac6cb8a4e8b6278baf8290 (diff) | |
增加内存池在线调试功能,用以解决内存池Buffer泄露的问题。v4.2.30-20171031
- 增加APP线程在用MBUF计算功能;
- 增加MBUF申请失败后,显示各内存池可用Buffer数量的功能。
Diffstat (limited to 'app/src/monit.c')
| -rw-r--r-- | app/src/monit.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/src/monit.c b/app/src/monit.c index 89ce937..cd4648d 100644 --- a/app/src/monit.c +++ b/app/src/monit.c @@ -202,6 +202,15 @@ static cJSON * monit_app_stat(struct mr_instance * instance) _trans_app_stat(mbuf_alloc_count); _trans_app_stat(mbuf_free_count); + /* 在用Buffer数量统计 */ + uint64_t __trans_mbuf_in_use_count[MR_SID_MAX]; + for (int i = 0; i < instance->nr_dataplane_thread; i++) + { + __trans_mbuf_in_use_count[i] = __trans_packet_recv_count[i] + + __trans_mbuf_alloc_count[i] - __trans_packet_send_count[i] - + __trans_mbuf_free_count[i]; + } + #define _json_generate(item) \ do { \ cJSON_AddItemToObject(j_root, #item, __create_uint64_array( \ @@ -216,6 +225,7 @@ do { \ _json_generate(packet_send_drop); _json_generate(mbuf_alloc_count); _json_generate(mbuf_free_count); + _json_generate(mbuf_in_use_count); #undef _trans_app_stat #undef _trans_app_stat_array |
