diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-10-13 08:37:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-10-13 08:38:18 +0000 |
commit | ca540a730c0b880922e86074f994a95b8d413bea (patch) | |
tree | 1364a1b82cfcc68f51aabf9b2545e6a06059d6bb /daemon/main.c | |
parent | Releasing debian version 1.17.1-1. (diff) | |
download | netdata-ca540a730c0b880922e86074f994a95b8d413bea.tar.xz netdata-ca540a730c0b880922e86074f994a95b8d413bea.zip |
Merging upstream version 1.18.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/main.c')
-rw-r--r-- | daemon/main.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/daemon/main.c b/daemon/main.c index bd0970fdd..4189ac7bd 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -306,7 +306,13 @@ int help(int exitcode) { " -W stacksize=N Set the stacksize (in bytes).\n\n" " -W debug_flags=N Set runtime tracing to debug.log.\n\n" " -W unittest Run internal unittests and exit.\n\n" +#ifdef ENABLE_DBENGINE " -W createdataset=N Create a DB engine dataset of N seconds and exit.\n\n" + " -W stresstest=A,B,C,D,E Run a DB engine stress test for A seconds,\n" + " with B writers and C readers, with a ramp up\n" + " time of D seconds for writers, a page cache\n" + " size of E MiB, and exit.\n\n" +#endif " -W set section option value\n" " set netdata.conf option from the command line.\n\n" " -W simple-pattern pattern string\n" @@ -719,7 +725,7 @@ int get_system_info(struct rrdhost_system_info *system_info) { } char n[51], v[101]; snprintfz(n, 50,"%s",name); - snprintfz(v, 101,"%s",value); + snprintfz(v, 100,"%s",value); if(unlikely(rrdhost_set_system_info_variable(system_info, n, v))) { info("Unexpected environment variable %s=%s", n, v); } @@ -887,6 +893,7 @@ int main(int argc, char **argv) { char* stacksize_string = "stacksize="; char* debug_flags_string = "debug_flags="; char* createdataset_string = "createdataset="; + char* stresstest_string = "stresstest="; if(strcmp(optarg, "unittest") == 0) { if(unit_test_buffer()) return 1; @@ -905,14 +912,33 @@ int main(int argc, char **argv) { fprintf(stderr, "\n\nALL TESTS PASSED\n\n"); return 0; } +#ifdef ENABLE_DBENGINE else if(strncmp(optarg, createdataset_string, strlen(createdataset_string)) == 0) { optarg += strlen(createdataset_string); -#ifdef ENABLE_DBENGINE - unsigned history_seconds = (unsigned )strtoull(optarg, NULL, 0); + unsigned history_seconds = strtoul(optarg, NULL, 0); generate_dbengine_dataset(history_seconds); -#endif return 0; } + else if(strncmp(optarg, stresstest_string, strlen(stresstest_string)) == 0) { + char *endptr; + unsigned test_duration_sec = 0, dset_charts = 0, query_threads = 0, ramp_up_seconds = 0, + page_cache_mb = 0; + + optarg += strlen(stresstest_string); + test_duration_sec = (unsigned)strtoul(optarg, &endptr, 0); + if (',' == *endptr) + dset_charts = (unsigned)strtoul(endptr + 1, &endptr, 0); + if (',' == *endptr) + query_threads = (unsigned)strtoul(endptr + 1, &endptr, 0); + if (',' == *endptr) + ramp_up_seconds = (unsigned)strtoul(endptr + 1, &endptr, 0); + if (',' == *endptr) + page_cache_mb = (unsigned)strtoul(endptr + 1, &endptr, 0); + dbengine_stress_test(test_duration_sec, dset_charts, query_threads, ramp_up_seconds, + page_cache_mb); + return 0; + } +#endif else if(strcmp(optarg, "simple-pattern") == 0) { if(optind + 2 > argc) { fprintf(stderr, "%s", "\nUSAGE: -W simple-pattern 'pattern' 'string'\n\n" |