Slon/Http/AdminServer: Display free memory in /info/stats
This commit is contained in:
parent
06c8433616
commit
c726b7e206
2 changed files with 6 additions and 2 deletions
|
@ -290,8 +290,12 @@ U0 @slon_admin_info_stats(SlonHttpSession* session)
|
||||||
SLON_SCRATCH_BUFFER_AND_REQUEST_JSON
|
SLON_SCRATCH_BUFFER_AND_REQUEST_JSON
|
||||||
no_warn request_json;
|
no_warn request_json;
|
||||||
|
|
||||||
|
I64 free_memory = sys_code_bp->alloced_u8s - sys_code_bp->used_u8s;
|
||||||
|
if (sys_data_bp) {
|
||||||
|
free_memory += sys_data_bp->alloced_u8s - sys_data_bp->used_u8s;
|
||||||
|
}
|
||||||
StrPrint(scratch_buffer, "{");
|
StrPrint(scratch_buffer, "{");
|
||||||
String.Append(scratch_buffer, "\"uptime\":\"%d\"", cnts.jiffies);
|
String.Append(scratch_buffer, "\"uptime\":%d,\"free_memory\":%d", cnts.jiffies, free_memory);
|
||||||
String.Append(scratch_buffer, "}");
|
String.Append(scratch_buffer, "}");
|
||||||
|
|
||||||
session->content_type("application/json");
|
session->content_type("application/json");
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
const request = new Request("/info/stats");
|
const request = new Request("/info/stats");
|
||||||
const response = await fetch(request);
|
const response = await fetch(request);
|
||||||
const stats = await response.json();
|
const stats = await response.json();
|
||||||
let html = "<h4 class=\"title is-4\">Statistics</h4><div class=spacer></div><div>Uptime: " + formatTime(stats["uptime"]) + "</div>";
|
let html = "<h4 class=\"title is-4\">Statistics</h4><div class=spacer></div><div>Uptime: " + formatTime(stats["uptime"]) + "<br/>Free memory: " + stats["free_memory"].toString() + " bytes<br/></div>";
|
||||||
setContent(html);
|
setContent(html);
|
||||||
setActiveLink("stats");
|
setActiveLink("stats");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue