YANG domain/spec support

cli show mem improvement
This commit is contained in:
Olof hagsand 2024-10-06 20:07:08 +02:00
parent 5ebc5a2219
commit b9ff2d083a
6 changed files with 39 additions and 36 deletions

View file

@ -416,7 +416,7 @@ clixon_stats_datastore_get(clixon_handle h,
return retval;
}
/*! Get clixon per datastore stats
/*! Get clixon per yang-spec stats
*
* @param[in] h Clixon handle
* @param[in] dbname Datastore name
@ -1462,13 +1462,13 @@ from_client_stats(clixon_handle h,
while ((ydomain = yn_iter(ymounts, &inext)) != NULL) {
domain = yang_argument_get(ydomain);
/* per module-set, first configuration, then main dbspec, then mountpoints */
cprintf(cbret, "<module-set>");
cprintf(cbret, "<name>%s</name>", domain);
if (clixon_stats_module_get(h, ydomain, cbret) < 0)
goto done;
if (modules){
inext2 = 0;
while ((yspec = yn_iter(ydomain, &inext2)) != NULL) {
inext2 = 0;
while ((yspec = yn_iter(ydomain, &inext2)) != NULL) {
cprintf(cbret, "<module-set>");
cprintf(cbret, "<name>%s/%s</name>", domain, yang_argument_get(yspec));
if (clixon_stats_module_get(h, ydomain, cbret) < 0)
goto done;
if (modules){
inext3 = 0;
while ((ymodule = yn_iter(yspec, &inext3)) != NULL) {
cprintf(cbret, "<module><name>%s</name>", yang_argument_get(ymodule));
@ -1477,8 +1477,8 @@ from_client_stats(clixon_handle h,
cprintf(cbret, "</module>");
}
}
cprintf(cbret, "</module-set>");
}
cprintf(cbret, "</module-set>");
}
cprintf(cbret, "</module-sets>");
cprintf(cbret, "</rpc-reply>");

View file

@ -1883,10 +1883,10 @@ cli_show_statistics(clixon_handle h,
parse_tree *pt;
uint64_t nr;
uint64_t tnr0;
uint64_t tnr;
uint64_t tnr = 0;
size_t sz;
size_t tsz0;
size_t tsz;
size_t tsz = 0;
yang_stmt *ymounts;
yang_stmt *ydomain;
yang_stmt *yspec;
@ -1946,10 +1946,10 @@ cli_show_statistics(clixon_handle h,
while ((yspec = yn_iter(ydomain, &inext2)) != NULL) {
name = yang_argument_get(yspec);
nr = 0; sz = 0;
if (yang_stats(ydomain, 0, &nr, &sz) < 0)
if (yang_stats(yspec, 0, &nr, &sz) < 0)
goto done;
tnr = nr;
tsz = sz;
tnr += nr;
tsz += sz;
if (detail) {
cligen_output(stdout, "YANG-%s-%s-size: %" PRIu64 "\n", domain, name, sz);
cligen_output(stdout, "YANG-%s-%s-nr: %" PRIu64 "\n", domain, name, nr);
@ -1963,8 +1963,8 @@ cli_show_statistics(clixon_handle h,
}
}
if (detail){
cligen_output(stdout, "YANG-total-size: %" PRIu64 "\n", sz);
cligen_output(stdout, "YANG-total-nr: %" PRIu64 "\n", sz);
cligen_output(stdout, "YANG-total-size: %" PRIu64 "\n", tsz);
cligen_output(stdout, "YANG-total-nr: %" PRIu64 "\n", tnr);
}
else {
translatenumber(tsz, &u64, &unit);