Skip to content
Snippets Groups Projects
Commit 4bb1713d authored by Jan Kadlec's avatar Jan Kadlec
Browse files

Small changes in mem. estimation.

- Changed magic constant to 1.2
- Info about total server memory consumption

Refs #37
parent 92f0dcbf
No related branches found
No related tags found
No related merge requests found
......@@ -862,6 +862,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
/* Zone checking */
int rc = 0;
node *n = 0;
size_t total_size = 0;
/* Generate databases for all zones */
WALK_LIST(n, conf()->zones) {
......@@ -949,18 +950,25 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
hattrie_apply_rev(est.dname_table, estimator_free_trie_node, NULL);
hattrie_free(est.node_table);
hattrie_free(est.dname_table);
log_zone_info("Zone %s: %zu RRs, signed=%.2f%%, used memory estimate=%zuMB\n",
size_t zone_size = (size_t)(((double)(est.rdata_size +
est.node_size +
est.rrset_size +
est.dname_size +
est.ahtable_size +
malloc_size) * 1.2) / (1024.0 * 1024.0));
log_zone_info("Zone %s: %zu RRs, signed=%.2f%%, used memory estimation=%zuMB.\n",
zone->name, est.record_count,
est.signed_count ?
((double)(est.record_count - est.signed_count)/ est.record_count) * 100 : 0.0,
(size_t)(((double)(est.rdata_size +
est.node_size +
est.rrset_size +
est.dname_size +
est.ahtable_size +
malloc_size) * 1.15) / (1024.0 * 1024.0)));
((double)(est.signed_count) / (est.record_count - est.signed_count)) * 100 : 0.0,
zone_size);
file_loader_free(loader);
total_size += zone_size;
}
if (argc == 0) { // for all zones
log_zone_info("Estimated memory consumption for all zones=%zuMB.\n", total_size);
}
return rc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment