* Added clixon-stats in clixon-config.yang for clixon XML and memory statistics.

This commit is contained in:
Olof hagsand 2020-03-01 10:59:24 +01:00
parent f1ceec689a
commit 2d521d52c8
12 changed files with 253 additions and 35 deletions

View file

@ -80,12 +80,6 @@
#include "clixon_validate.h"
#include "clixon_xml_map.h"
/*! Clixon configuration namespace
* Probably should be defined somewhere else or extracted from yang
* @see clixon-config.yang
*/
#define CLIXON_CONF_NS "http://clicon.org/config"
/* Mapping between Cli generation from Yang string <--> constants,
see clixon-config.yang type cli_genmodel_type */
static const map_str2int cli_genmodel_map[] = {

View file

@ -237,8 +237,19 @@ xml_stats_one(cxobj *x,
sz += cv_size(x->x_cv);
if (x->x_ns_cache)
sz += cvec_size(x->x_ns_cache);
#ifdef XML_EXPLICIT_INDEX
if (x->x_search_index){
/* XXX: only one */
sz += sizeof(struct search_index);
if (x->x_search_index->si_name)
sz += strlen(x->x_search_index->si_name)+1;
if (x->x_search_index->si_xvec)
sz += clixon_xvec_len(x->x_search_index->si_xvec)*sizeof(struct cxobj*);
}
#endif
if (szp)
*szp = sz;
clicon_debug(1, "%s %" PRIu64, __FUNCTION__, sz);
return 0;
}
@ -261,10 +272,12 @@ xml_stats(cxobj *xt,
*szp += sz;
xc = NULL;
while ((xc = xml_child_each(xt, xc, -1)) != NULL) {
sz=0;
xml_stats(xc, nrp, &sz);
if (szp)
*szp += sz;
}
clicon_debug(1, "%s %" PRIu64, __FUNCTION__, *szp);
return 0;
}

View file

@ -2,7 +2,8 @@
*
***** BEGIN LICENSE BLOCK *****
Copyright (C) 2009-2020 Olof Hagsand
Copyright (C) 2009-2019 Olof Hagsand
Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC
This file is part of CLIXON.