0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

fixup! various fices

This commit is contained in:
Katerina Kubecova 2023-11-23 09:51:48 +01:00
parent 1fb14f5769
commit 6ab2f0fa54
3 changed files with 20 additions and 18 deletions

View File

@ -159,9 +159,12 @@ cmd_show_memory(void)
struct cbor_writer *w = cbor_init(lp_new(proto_pool), 1000); struct cbor_writer *w = cbor_init(lp_new(proto_pool), 1000);
cbor_open_block_with_length(w, 1);
cbor_add_string(w, "show_memory:message");
cbor_open_block_with_length(w, 2); cbor_open_block_with_length(w, 2);
cbor_string_string(w, "BIRD memory usage", "header"); cbor_string_string(w, "header", "BIRD memory usage");
cbor_add_string(w, "body"); cbor_add_string(w, "body");
cbor_open_block(w); cbor_open_block(w);
@ -180,15 +183,14 @@ cmd_show_memory(void)
memory = rmemsize(&root_pool); memory = rmemsize(&root_pool);
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
cbor_named_block_two_ints(w, "standby", "effective", 0, "overhead", page_size * *pages_kept); cbor_named_block_two_ints(w, "standby_memory", "effective", 0, "overhead", page_size * *pages_kept);
#endif #endif
memory.overhead += page_size * *pages_kept; memory.overhead += page_size * *pages_kept;
cbor_named_block_two_ints(w, "total", "effective", memory.effective, "overhead", memory.overhead); cbor_named_block_two_ints(w, "total", "effective", memory.effective, "overhead", memory.overhead);
cbor_close_block_or_list(w); // we do not know for sure, that standby memory will be printed, so we do not know number of block items. If we know that, we open the block for 6 (or 5) items and we do not close anything cbor_close_block_or_list(w); // we do not know for sure, that standby memory will be printed, so we do not know number of block items. If we know that, we open the block for 6 (or 5) items and we do not close anything
cbor_write_to_file(w, "/home/kkubecova/Dokumenty/bird/yang/show_memory_generated.cbor");
cbor_write_to_file(w, "/home/kkubecova/Dokumenty/bird/yang/show_memory_generated.yang");
} }

Binary file not shown.

View File

@ -3,28 +3,28 @@
"header": "BIRD memory usage", "header": "BIRD memory usage",
"body": { "body": {
"routing_tables": { "routing_tables": {
"effective": 324, "effective": 34604,
"overhead": 48 "overhead": 2848
}, },
"route_attributes": { "route_attributes": {
"effective": 324, "effective": 26826,
"overhead": 48 "overhead": 13448
}, },
"protocols": { "protocols": {
"effective": 324, "effective": 70412,
"overhead": 48 "overhead": 18256
}, },
"current_config": { "current_config": {
"effective": 324, "effective": 299744,
"overhead": 48 "overhead": 2152
}, },
"standby_memory": { "standby_memory": {
"effective": 324, "effective": 0,
"overhead": 48 "overhead": 348160
}, },
"total": { "total": {
"effective": 324, "effective": 513602,
"overhead": 48 "overhead": 391904
} }
} }
} }