* Added option: CLICON_CLI_BUF_START and CLICON_CLI_BUF_THRESHOLD so you can change the start and
threshold of quadratic and linear growth of CLIgen buffers (cbuf:s) * Memory footprint * Do not autopopulate namespace cache, instead use on-demand, see `xml2ns()`. * Set CBUF start level to 256 (`CLICON_CLI_BUF_START` option) * Reduced xml child vector default size from 4 to 1 with quadratic growoth to 64K then linear
This commit is contained in:
parent
250ead517c
commit
0f54899ae4
17 changed files with 393 additions and 124 deletions
|
|
@ -266,24 +266,23 @@ client_get_streams(clicon_handle h,
|
|||
*/
|
||||
static int
|
||||
clixon_stats_get_db(clicon_handle h,
|
||||
char *name,
|
||||
char *dbname,
|
||||
cbuf *cb)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *xt = NULL;
|
||||
uint64_t nr = 0;
|
||||
size_t sz = 0;
|
||||
|
||||
if (xmldb_get(h, "running", NULL, NULL, &xt) < 0)
|
||||
goto done;
|
||||
db_elmnt *de = NULL;
|
||||
|
||||
/* This is the db cache */
|
||||
if ((de = clicon_db_elmnt_get(h, dbname)) != NULL)
|
||||
xt = de->de_xml;
|
||||
xml_stats(xt, &nr, &sz);
|
||||
cprintf(cb, "<datastore><name>%s</name><nr>%" PRIu64 "</nr>"
|
||||
"<size>%" PRIu64 "</size></datastore>",
|
||||
name, nr, sz);
|
||||
dbname, nr, sz);
|
||||
retval = 0;
|
||||
done:
|
||||
if (xt)
|
||||
free(xt);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -460,6 +460,8 @@ main(int argc,
|
|||
char *dir;
|
||||
gid_t gid = -1;
|
||||
cvec *nsctx_global = NULL; /* Global namespace context */
|
||||
size_t cligen_buflen;
|
||||
size_t cligen_bufthreshold;
|
||||
|
||||
/* In the startup, logs to stderr & syslog and debug flag set later */
|
||||
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
|
||||
|
|
@ -623,11 +625,16 @@ main(int argc,
|
|||
clicon_argv_set(h, argv0, argc, argv);
|
||||
|
||||
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
|
||||
|
||||
|
||||
/* Defer: Wait to the last minute to print help message */
|
||||
if (help)
|
||||
usage(h, argv[0]);
|
||||
|
||||
/* Init cligen buffers */
|
||||
cligen_buflen = clicon_option_int(h, "CLICON_CLI_BUF_START");
|
||||
cligen_bufthreshold = clicon_option_int(h, "CLICON_CLI_BUF_THRESHOLD");
|
||||
cbuf_alloc_set(cligen_buflen, cligen_bufthreshold);
|
||||
|
||||
#ifndef HAVE_LIBXML2
|
||||
if (clicon_yang_regexp(h) == REGEXP_LIBXML2){
|
||||
clicon_err(OE_FATAL, 0, "CLICON_YANG_REGEXP set to libxml2, but HAVE_LIBXML2 not set (Either change CLICON_YANG_REGEXP to posix, or run: configure --with-libxml2))");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue