RRDDIM *rd_interrupt;
RRDDIM *rd_idle;
} *all_cpu_charts = NULL;
+ static int old_number_of_cpus = 0;
- all_cpu_charts = reallocz(all_cpu_charts, sizeof(struct cpu_chart) * number_of_cpus);
+ if(unlikely(number_of_cpus > old_number_of_cpus)) {
+ all_cpu_charts = reallocz(all_cpu_charts, sizeof(struct cpu_chart) * number_of_cpus);
+ memset(&all_cpu_charts[old_number_of_cpus], 0, sizeof(struct softnet_chart) * (number_of_cpus - old_number_of_cpus));
+ old_number_of_cpus = number_of_cpus;
+ }
for (i = 0; i < number_of_cpus; i++) {
if (unlikely(!all_cpu_charts[i].st)) {
return 1;
} else {
netisr_stats = reallocz(netisr_stats, (number_of_cpus + 1) * sizeof(struct netisr_stats));
- bzero(netisr_stats, (number_of_cpus + 1) * sizeof(struct netisr_stats));
+ memset(netisr_stats, 0, (number_of_cpus + 1) * sizeof(struct netisr_stats));
for (i = 0; i < num_netisr_workstreams; i++) {
for (n = 0; n < num_netisr_works; n++) {
if (netisr_workstream[i].snws_wsid == netisr_work[n].snw_wsid) {
RRDDIM *rd_qdrops;
RRDDIM *rd_queued;
} *all_softnet_charts = NULL;
+ static int old_number_of_cpus = 0;
- all_softnet_charts = reallocz(all_softnet_charts, sizeof(struct softnet_chart) * number_of_cpus);
+ if(unlikely(number_of_cpus > old_number_of_cpus)) {
+ all_softnet_charts = reallocz(all_softnet_charts, sizeof(struct softnet_chart) * number_of_cpus);
+ memset(&all_softnet_charts[old_number_of_cpus], 0, sizeof(struct softnet_chart) * (number_of_cpus - old_number_of_cpus));
+ old_number_of_cpus = number_of_cpus;
+ }
for (i = 0; i < number_of_cpus ;i++) {
snprintfz(all_softnet_charts[i].netisr_cpuid, MAX_INT_DIGITS + 17, "cpu%d_softnet_stat", i);
dstat = devstat_data + sizeof(long); // skip generation number
for (i = 0; i < numdevs; i++) {
- if (unlikely(!do_system_io)) {
+ if (likely(do_system_io)) {
if (((dstat[i].device_type & DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_DIRECT) || ((dstat[i].device_type & DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_STORARRAY)) {
total_disk_kbytes_read += dstat[i].bytes[DEVSTAT_READ] / KILO_FACTOR;
total_disk_kbytes_write += dstat[i].bytes[DEVSTAT_WRITE] / KILO_FACTOR;
// --------------------------------------------------------------------
- if (unlikely(!do_system_io)) {
+ if (likely(do_system_io)) {
static RRDSET *st = NULL;
static RRDDIM *rd_in = NULL, *rd_out = NULL;
- st = rrdset_find_bytype_localhost("system", "io");
if (unlikely(!st)) {
st = rrdset_create_localhost("system",
"io",