diff --git a/nest/cmds.c b/nest/cmds.c index 4562262a..941a01a1 100644 --- a/nest/cmds.c +++ b/nest/cmds.c @@ -159,9 +159,12 @@ cmd_show_memory(void) 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_string_string(w, "BIRD memory usage", "header"); + cbor_string_string(w, "header", "BIRD memory usage"); cbor_add_string(w, "body"); cbor_open_block(w); @@ -180,15 +183,14 @@ cmd_show_memory(void) memory = rmemsize(&root_pool); #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 memory.overhead += page_size * *pages_kept; 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.yang"); + cbor_write_to_file(w, "/home/kkubecova/Dokumenty/bird/yang/show_memory_generated.cbor"); } diff --git a/yang/show_memory.cbor b/yang/show_memory.cbor index f1cfe02c..3c524475 100644 Binary files a/yang/show_memory.cbor and b/yang/show_memory.cbor differ diff --git a/yang/show_memory.json b/yang/show_memory.json index 85c972f1..124e26d6 100644 --- a/yang/show_memory.json +++ b/yang/show_memory.json @@ -3,29 +3,29 @@ "header": "BIRD memory usage", "body": { "routing_tables": { - "effective": 324, - "overhead": 48 + "effective": 34604, + "overhead": 2848 }, "route_attributes": { - "effective": 324, - "overhead": 48 + "effective": 26826, + "overhead": 13448 }, "protocols": { - "effective": 324, - "overhead": 48 + "effective": 70412, + "overhead": 18256 }, "current_config": { - "effective": 324, - "overhead": 48 + "effective": 299744, + "overhead": 2152 }, "standby_memory": { - "effective": 324, - "overhead": 48 + "effective": 0, + "overhead": 348160 }, "total": { - "effective": 324, - "overhead": 48 + "effective": 513602, + "overhead": 391904 } } } -} +} \ No newline at end of file