more speed improvements
Costa Tsaousis (ktsaou) committed
Sep 10, 2017 at 13:40 UTC
fb0190dd76343bd3e55b7e0028cab7926031dca7
6 files changed
+471
-207
src/proc_net_netstat.c
+344
-165
@@ -232,151 +232,255 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
232
233
parse_line_pair(ff, arl_ipext, h, l);
234
235
- RRDSET *st;
236
-
235
// --------------------------------------------------------------------
236
237
if(do_bandwidth == CONFIG_BOOLEAN_YES || (do_bandwidth == CONFIG_BOOLEAN_AUTO && (ipext_InOctets || ipext_OutOctets))) {
238
do_bandwidth = CONFIG_BOOLEAN_YES;
241
- st = rrdset_find_localhost("system.ipv4");
242
- if(unlikely(!st)) {
243
- st = rrdset_create_localhost("system", "ipv4", NULL, "network", NULL, "IPv4 Bandwidth", "kilobits/s"
244
- , 500, update_every, RRDSET_TYPE_AREA);
245
-
246
- rrddim_add(st, "InOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
247
- rrddim_add(st, "OutOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
239
+ static RRDSET *st_system_ipv4 = NULL;
240
+ static RRDDIM *rd_in = NULL, *rd_out = NULL;
241
+
242
+ if(unlikely(!st_system_ipv4)) {
243
+ st_system_ipv4 = rrdset_create_localhost(
244
+ "system"
245
+ , "ipv4"
246
+ , NULL
247
+ , "network"
248
+ , NULL
249
+ , "IPv4 Bandwidth"
250
+ , "kilobits/s"
251
+ , 500
252
+ , update_every
253
+ , RRDSET_TYPE_AREA
254
+ );
255
+
256
+ rd_in = rrddim_add(st_system_ipv4, "InOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
257
+ rd_out = rrddim_add(st_system_ipv4, "OutOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
258
}
249
- else rrdset_next(st);
259
+ else
260
+ rrdset_next(st_system_ipv4);
261
251
- rrddim_set(st, "InOctets", ipext_InOctets);
252
- rrddim_set(st, "OutOctets", ipext_OutOctets);
253
- rrdset_done(st);
262
+ rrddim_set_by_pointer(st_system_ipv4, rd_in, ipext_InOctets);
263
+ rrddim_set_by_pointer(st_system_ipv4, rd_out, ipext_OutOctets);
264
+
265
+ rrdset_done(st_system_ipv4);
266
}
267
268
// --------------------------------------------------------------------
269
270
if(do_inerrors == CONFIG_BOOLEAN_YES || (do_inerrors == CONFIG_BOOLEAN_AUTO && (ipext_InNoRoutes || ipext_InTruncatedPkts))) {
271
do_inerrors = CONFIG_BOOLEAN_YES;
260
- st = rrdset_find_localhost("ipv4.inerrors");
261
- if(unlikely(!st)) {
262
- st = rrdset_create_localhost("ipv4", "inerrors", NULL, "errors", NULL, "IPv4 Input Errors"
263
- , "packets/s", 4000, update_every, RRDSET_TYPE_LINE);
264
- rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
265
-
266
- rrddim_add(st, "InNoRoutes", "noroutes", 1, 1, RRD_ALGORITHM_INCREMENTAL);
267
- rrddim_add(st, "InTruncatedPkts", "truncated", 1, 1, RRD_ALGORITHM_INCREMENTAL);
268
- rrddim_add(st, "InCsumErrors", "checksum", 1, 1, RRD_ALGORITHM_INCREMENTAL);
272
+ static RRDSET *st_ipv4_inerrors = NULL;
273
+ static RRDDIM *rd_noroutes = NULL, *rd_truncated = NULL, *rd_checksum = NULL;
274
+
275
+ if(unlikely(!st_ipv4_inerrors)) {
276
+ st_ipv4_inerrors = rrdset_create_localhost(
277
+ "ipv4"
278
+ , "inerrors"
279
+ , NULL
280
+ , "errors"
281
+ , NULL
282
+ , "IPv4 Input Errors"
283
+ , "packets/s"
284
+ , 4000
285
+ , update_every
286
+ , RRDSET_TYPE_LINE
287
+ );
288
+
289
+ rrdset_flag_set(st_ipv4_inerrors, RRDSET_FLAG_DETAIL);
290
+
291
+ rd_noroutes = rrddim_add(st_ipv4_inerrors, "InNoRoutes", "noroutes", 1, 1, RRD_ALGORITHM_INCREMENTAL);
292
+ rd_truncated = rrddim_add(st_ipv4_inerrors, "InTruncatedPkts", "truncated", 1, 1, RRD_ALGORITHM_INCREMENTAL);
293
+ rd_checksum = rrddim_add(st_ipv4_inerrors, "InCsumErrors", "checksum", 1, 1, RRD_ALGORITHM_INCREMENTAL);
294
}
270
- else rrdset_next(st);
295
+ else
296
+ rrdset_next(st_ipv4_inerrors);
297
+
298
+ rrddim_set_by_pointer(st_ipv4_inerrors, rd_noroutes, ipext_InNoRoutes);
299
+ rrddim_set_by_pointer(st_ipv4_inerrors, rd_truncated, ipext_InTruncatedPkts);
300
+ rrddim_set_by_pointer(st_ipv4_inerrors, rd_checksum, ipext_InCsumErrors);
301
272
- rrddim_set(st, "InNoRoutes", ipext_InNoRoutes);
273
- rrddim_set(st, "InTruncatedPkts", ipext_InTruncatedPkts);
274
- rrddim_set(st, "InCsumErrors", ipext_InCsumErrors);
275
- rrdset_done(st);
302
+ rrdset_done(st_ipv4_inerrors);
303
}
304
305
// --------------------------------------------------------------------
306
307
if(do_mcast == CONFIG_BOOLEAN_YES || (do_mcast == CONFIG_BOOLEAN_AUTO && (ipext_InMcastOctets || ipext_OutMcastOctets))) {
308
do_mcast = CONFIG_BOOLEAN_YES;
282
- st = rrdset_find_localhost("ipv4.mcast");
283
- if(unlikely(!st)) {
284
- st = rrdset_create_localhost("ipv4", "mcast", NULL, "multicast", NULL, "IPv4 Multicast Bandwidth"
285
- , "kilobits/s", 9000, update_every, RRDSET_TYPE_AREA);
286
- rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
287
-
288
- rrddim_add(st, "InMcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
289
- rrddim_add(st, "OutMcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
309
+ static RRDSET *st_ipv4_mcast = NULL;
310
+ static RRDDIM *rd_in = NULL, *rd_out = NULL;
311
+
312
+ if(unlikely(!st_ipv4_mcast)) {
313
+ st_ipv4_mcast = rrdset_create_localhost(
314
+ "ipv4"
315
+ , "mcast"
316
+ , NULL
317
+ , "multicast"
318
+ , NULL
319
+ , "IPv4 Multicast Bandwidth"
320
+ , "kilobits/s"
321
+ , 9000
322
+ , update_every
323
+ , RRDSET_TYPE_AREA
324
+ );
325
+
326
+ rrdset_flag_set(st_ipv4_mcast, RRDSET_FLAG_DETAIL);
327
+
328
+ rd_in = rrddim_add(st_ipv4_mcast, "InMcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
329
+ rd_out = rrddim_add(st_ipv4_mcast, "OutMcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
330
}
291
- else rrdset_next(st);
331
+ else
332
+ rrdset_next(st_ipv4_mcast);
333
293
- rrddim_set(st, "InMcastOctets", ipext_InMcastOctets);
294
- rrddim_set(st, "OutMcastOctets", ipext_OutMcastOctets);
295
- rrdset_done(st);
334
+ rrddim_set_by_pointer(st_ipv4_mcast, rd_in, ipext_InMcastOctets);
335
+ rrddim_set_by_pointer(st_ipv4_mcast, rd_out, ipext_OutMcastOctets);
336
+
337
+ rrdset_done(st_ipv4_mcast);
338
}
339
340
// --------------------------------------------------------------------
341
342
if(do_bcast == CONFIG_BOOLEAN_YES || (do_bcast == CONFIG_BOOLEAN_AUTO && (ipext_InBcastOctets || ipext_OutBcastOctets))) {
343
do_bcast = CONFIG_BOOLEAN_YES;
302
- st = rrdset_find_localhost("ipv4.bcast");
303
- if(unlikely(!st)) {
304
- st = rrdset_create_localhost("ipv4", "bcast", NULL, "broadcast", NULL, "IPv4 Broadcast Bandwidth"
305
- , "kilobits/s", 8000, update_every, RRDSET_TYPE_AREA);
306
- rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
307
-
308
- rrddim_add(st, "InBcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
309
- rrddim_add(st, "OutBcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
344
+
345
+ static RRDSET *st_ipv4_bcast = NULL;
346
+ static RRDDIM *rd_in = NULL, *rd_out = NULL;
347
+
348
+ if(unlikely(!st_ipv4_bcast)) {
349
+ st_ipv4_bcast = rrdset_create_localhost(
350
+ "ipv4"
351
+ , "bcast"
352
+ , NULL
353
+ , "broadcast"
354
+ , NULL
355
+ , "IPv4 Broadcast Bandwidth"
356
+ , "kilobits/s"
357
+ , 8000
358
+ , update_every
359
+ , RRDSET_TYPE_AREA
360
+ );
361
+
362
+ rrdset_flag_set(st_ipv4_bcast, RRDSET_FLAG_DETAIL);
363
+
364
+ rd_in = rrddim_add(st_ipv4_bcast, "InBcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
365
+ rd_out = rrddim_add(st_ipv4_bcast, "OutBcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
366
}
311
- else rrdset_next(st);
367
+ else
368
+ rrdset_next(st_ipv4_bcast);
369
+
370
+ rrddim_set_by_pointer(st_ipv4_bcast, rd_in, ipext_InBcastOctets);
371
+ rrddim_set_by_pointer(st_ipv4_bcast, rd_out, ipext_OutBcastOctets);
372
313
- rrddim_set(st, "InBcastOctets", ipext_InBcastOctets);
314
- rrddim_set(st, "OutBcastOctets", ipext_OutBcastOctets);
315
- rrdset_done(st);
373
+ rrdset_done(st_ipv4_bcast);
374
}
375
376
// --------------------------------------------------------------------
377
378
if(do_mcast_p == CONFIG_BOOLEAN_YES || (do_mcast_p == CONFIG_BOOLEAN_AUTO && (ipext_InMcastPkts || ipext_OutMcastPkts))) {
379
do_mcast_p = CONFIG_BOOLEAN_YES;
322
- st = rrdset_find_localhost("ipv4.mcastpkts");
323
- if(unlikely(!st)) {
324
- st = rrdset_create_localhost("ipv4", "mcastpkts", NULL, "multicast", NULL, "IPv4 Multicast Packets"
325
- , "packets/s", 8600, update_every, RRDSET_TYPE_LINE);
326
- rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
327
-
328
- rrddim_add(st, "InMcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
329
- rrddim_add(st, "OutMcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
380
+
381
+ static RRDSET *st_ipv4_mcastpkts = NULL;
382
+ static RRDDIM *rd_in = NULL, *rd_out = NULL;
383
+
384
+ if(unlikely(!st_ipv4_mcastpkts)) {
385
+ st_ipv4_mcastpkts = rrdset_create_localhost(
386
+ "ipv4"
387
+ , "mcastpkts"
388
+ , NULL
389
+ , "multicast"
390
+ , NULL
391
+ , "IPv4 Multicast Packets"
392
+ , "packets/s"
393
+ , 8600
394
+ , update_every
395
+ , RRDSET_TYPE_LINE
396
+ );
397
+
398
+ rrdset_flag_set(st_ipv4_mcastpkts, RRDSET_FLAG_DETAIL);
399
+
400
+ rd_in = rrddim_add(st_ipv4_mcastpkts, "InMcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
401
+ rd_out = rrddim_add(st_ipv4_mcastpkts, "OutMcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
402
}
331
- else rrdset_next(st);
403
+ else rrdset_next(st_ipv4_mcastpkts);
404
+
405
+ rrddim_set_by_pointer(st_ipv4_mcastpkts, rd_in, ipext_InMcastPkts);
406
+ rrddim_set_by_pointer(st_ipv4_mcastpkts, rd_out, ipext_OutMcastPkts);
407
333
- rrddim_set(st, "InMcastPkts", ipext_InMcastPkts);
334
- rrddim_set(st, "OutMcastPkts", ipext_OutMcastPkts);
335
- rrdset_done(st);
408
+ rrdset_done(st_ipv4_mcastpkts);
409
}
410
411
// --------------------------------------------------------------------
412
413
if(do_bcast_p == CONFIG_BOOLEAN_YES || (do_bcast_p == CONFIG_BOOLEAN_AUTO && (ipext_InBcastPkts || ipext_OutBcastPkts))) {
414
do_bcast_p = CONFIG_BOOLEAN_YES;
342
- st = rrdset_find_localhost("ipv4.bcastpkts");
343
- if(unlikely(!st)) {
344
- st = rrdset_create_localhost("ipv4", "bcastpkts", NULL, "broadcast", NULL, "IPv4 Broadcast Packets"
345
- , "packets/s", 8500, update_every, RRDSET_TYPE_LINE);
346
- rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
347
-
348
- rrddim_add(st, "InBcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
349
- rrddim_add(st, "OutBcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
415
+
416
+ static RRDSET *st_ipv4_bcastpkts = NULL;
417
+ static RRDDIM *rd_in = NULL, *rd_out = NULL;
418
+
419
+ if(unlikely(!st_ipv4_bcastpkts)) {
420
+ st_ipv4_bcastpkts = rrdset_create_localhost(
421
+ "ipv4"
422
+ , "bcastpkts"
423
+ , NULL
424
+ , "broadcast"
425
+ , NULL
426
+ , "IPv4 Broadcast Packets"
427
+ , "packets/s"
428
+ , 8500
429
+ , update_every
430
+ , RRDSET_TYPE_LINE
431
+ );
432
+
433
+ rrdset_flag_set(st_ipv4_bcastpkts, RRDSET_FLAG_DETAIL);
434
+
435
+ rd_in = rrddim_add(st_ipv4_bcastpkts, "InBcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
436
+ rd_out = rrddim_add(st_ipv4_bcastpkts, "OutBcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
437
}
351
- else rrdset_next(st);
438
+ else
439
+ rrdset_next(st_ipv4_bcastpkts);
440
353
- rrddim_set(st, "InBcastPkts", ipext_InBcastPkts);
354
- rrddim_set(st, "OutBcastPkts", ipext_OutBcastPkts);
355
- rrdset_done(st);
441
+ rrddim_set_by_pointer(st_ipv4_bcastpkts, rd_in, ipext_InBcastPkts);
442
+ rrddim_set_by_pointer(st_ipv4_bcastpkts, rd_out, ipext_OutBcastPkts);
443
+
444
+ rrdset_done(st_ipv4_bcastpkts);
445
}
446
447
// --------------------------------------------------------------------
448
449
if(do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO && (ipext_InCEPkts || ipext_InECT0Pkts || ipext_InECT1Pkts || ipext_InNoECTPkts))) {
450
do_ecn = CONFIG_BOOLEAN_YES;
362
- st = rrdset_find_localhost("ipv4.ecnpkts");
363
- if(unlikely(!st)) {
364
- st = rrdset_create_localhost("ipv4", "ecnpkts", NULL, "ecn", NULL, "IPv4 ECN Statistics"
365
- , "packets/s", 8700, update_every, RRDSET_TYPE_LINE);
366
- rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
367
-
368
- rrddim_add(st, "InCEPkts", "CEP", 1, 1, RRD_ALGORITHM_INCREMENTAL);
369
- rrddim_add(st, "InNoECTPkts", "NoECTP", -1, 1, RRD_ALGORITHM_INCREMENTAL);
370
- rrddim_add(st, "InECT0Pkts", "ECTP0", 1, 1, RRD_ALGORITHM_INCREMENTAL);
371
- rrddim_add(st, "InECT1Pkts", "ECTP1", 1, 1, RRD_ALGORITHM_INCREMENTAL);
451
+
452
+ static RRDSET *st_ecnpkts = NULL;
453
+ static RRDDIM *rd_cep = NULL, *rd_noectp = NULL, *rd_ectp0 = NULL, *rd_ectp1 = NULL;
454
+
455
+ if(unlikely(!st_ecnpkts)) {
456
+ st_ecnpkts = rrdset_create_localhost(
457
+ "ipv4"
458
+ , "ecnpkts"
459
+ , NULL
460
+ , "ecn"
461
+ , NULL
462
+ , "IPv4 ECN Statistics"
463
+ , "packets/s"
464
+ , 8700
465
+ , update_every
466
+ , RRDSET_TYPE_LINE
467
+ );
468
+
469
+ rrdset_flag_set(st_ecnpkts, RRDSET_FLAG_DETAIL);
470
+
471
+ rd_cep = rrddim_add(st_ecnpkts, "InCEPkts", "CEP", 1, 1, RRD_ALGORITHM_INCREMENTAL);
472
+ rd_noectp = rrddim_add(st_ecnpkts, "InNoECTPkts", "NoECTP", -1, 1, RRD_ALGORITHM_INCREMENTAL);
473
+ rd_ectp0 = rrddim_add(st_ecnpkts, "InECT0Pkts", "ECTP0", 1, 1, RRD_ALGORITHM_INCREMENTAL);
474
+ rd_ectp1 = rrddim_add(st_ecnpkts, "InECT1Pkts", "ECTP1", 1, 1, RRD_ALGORITHM_INCREMENTAL);
475
}
373
- else rrdset_next(st);
476
+ else rrdset_next(st_ecnpkts);
477
+
478
+ rrddim_set_by_pointer(st_ecnpkts, rd_cep, ipext_InCEPkts);
479
+ rrddim_set_by_pointer(st_ecnpkts, rd_noectp, ipext_InNoECTPkts);
480
+ rrddim_set_by_pointer(st_ecnpkts, rd_ectp0, ipext_InECT0Pkts);
481
+ rrddim_set_by_pointer(st_ecnpkts, rd_ectp1, ipext_InECT1Pkts);
482
375
- rrddim_set(st, "InCEPkts", ipext_InCEPkts);
376
- rrddim_set(st, "InNoECTPkts", ipext_InNoECTPkts);
377
- rrddim_set(st, "InECT0Pkts", ipext_InECT0Pkts);
378
- rrddim_set(st, "InECT1Pkts", ipext_InECT1Pkts);
379
- rrdset_done(st);
483
+ rrdset_done(st_ecnpkts);
484
}
485
}
486
else if(unlikely(hash == hash_tcpext && strcmp(key, "TcpExt") == 0)) {
@@ -390,117 +494,192 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
494
495
parse_line_pair(ff, arl_tcpext, h, l);
496
393
- RRDSET *st;
394
-
497
// --------------------------------------------------------------------
498
499
if(do_tcpext_memory == CONFIG_BOOLEAN_YES || (do_tcpext_memory == CONFIG_BOOLEAN_AUTO && (tcpext_TCPMemoryPressures))) {
500
do_tcpext_memory = CONFIG_BOOLEAN_YES;
399
- st = rrdset_find_localhost("ipv4.tcpmemorypressures");
400
- if(unlikely(!st)) {
401
- st = rrdset_create_localhost("ipv4", "tcpmemorypressures", NULL, "tcp", NULL, "TCP Memory Pressures"
402
- , "events/s", 3000, update_every, RRDSET_TYPE_LINE);
501
404
- rrddim_add(st, "TCPMemoryPressures", "pressures", 1, 1, RRD_ALGORITHM_INCREMENTAL);
502
+ static RRDSET *st_tcpmemorypressures = NULL;
503
+ static RRDDIM *rd_pressures = NULL;
504
+
505
+ if(unlikely(!st_tcpmemorypressures)) {
506
+ st_tcpmemorypressures = rrdset_create_localhost(
507
+ "ipv4"
508
+ , "tcpmemorypressures"
509
+ , NULL
510
+ , "tcp"
511
+ , NULL
512
+ , "TCP Memory Pressures"
513
+ , "events/s"
514
+ , 3000
515
+ , update_every
516
+ , RRDSET_TYPE_LINE
517
+ );
518
+
519
+ rd_pressures = rrddim_add(st_tcpmemorypressures, "TCPMemoryPressures", "pressures", 1, 1, RRD_ALGORITHM_INCREMENTAL);
520
}
406
- else rrdset_next(st);
521
+ else
522
+ rrdset_next(st_tcpmemorypressures);
523
+
524
+ rrddim_set_by_pointer(st_tcpmemorypressures, rd_pressures, tcpext_TCPMemoryPressures);
525
408
- rrddim_set(st, "TCPMemoryPressures", tcpext_TCPMemoryPressures);
409
- rrdset_done(st);
526
+ rrdset_done(st_tcpmemorypressures);
527
}
528
529
// --------------------------------------------------------------------
530
531
if(do_tcpext_connaborts == CONFIG_BOOLEAN_YES || (do_tcpext_connaborts == CONFIG_BOOLEAN_AUTO && (tcpext_TCPAbortOnData || tcpext_TCPAbortOnClose || tcpext_TCPAbortOnMemory || tcpext_TCPAbortOnTimeout || tcpext_TCPAbortOnLinger || tcpext_TCPAbortFailed))) {
532
do_tcpext_connaborts = CONFIG_BOOLEAN_YES;
416
- st = rrdset_find_localhost("ipv4.tcpconnaborts");
417
- if(unlikely(!st)) {
418
- st = rrdset_create_localhost("ipv4", "tcpconnaborts", NULL, "tcp", NULL, "TCP Connection Aborts"
419
- , "connections/s", 3010, update_every, RRDSET_TYPE_LINE);
420
-
421
- rrddim_add(st, "TCPAbortOnData", "baddata", 1, 1, RRD_ALGORITHM_INCREMENTAL);
422
- rrddim_add(st, "TCPAbortOnClose", "userclosed", 1, 1, RRD_ALGORITHM_INCREMENTAL);
423
- rrddim_add(st, "TCPAbortOnMemory", "nomemory", 1, 1, RRD_ALGORITHM_INCREMENTAL);
424
- rrddim_add(st, "TCPAbortOnTimeout", "timeout", 1, 1, RRD_ALGORITHM_INCREMENTAL);
425
- rrddim_add(st, "TCPAbortOnLinger", "linger", 1, 1, RRD_ALGORITHM_INCREMENTAL);
426
- rrddim_add(st, "TCPAbortFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
533
+
534
+ static RRDSET *st_tcpconnaborts = NULL;
535
+ static RRDDIM *rd_baddata = NULL, *rd_userclosed = NULL, *rd_nomemory = NULL, *rd_timeout = NULL, *rd_linger = NULL, *rd_failed = NULL;
536
+
537
+ if(unlikely(!st_tcpconnaborts)) {
538
+ st_tcpconnaborts = rrdset_create_localhost(
539
+ "ipv4"
540
+ , "tcpconnaborts"
541
+ , NULL
542
+ , "tcp"
543
+ , NULL
544
+ , "TCP Connection Aborts"
545
+ , "connections/s"
546
+ , 3010
547
+ , update_every
548
+ , RRDSET_TYPE_LINE
549
+ );
550
+
551
+ rd_baddata = rrddim_add(st_tcpconnaborts, "TCPAbortOnData", "baddata", 1, 1, RRD_ALGORITHM_INCREMENTAL);
552
+ rd_userclosed = rrddim_add(st_tcpconnaborts, "TCPAbortOnClose", "userclosed", 1, 1, RRD_ALGORITHM_INCREMENTAL);
553
+ rd_nomemory = rrddim_add(st_tcpconnaborts, "TCPAbortOnMemory", "nomemory", 1, 1, RRD_ALGORITHM_INCREMENTAL);
554
+ rd_timeout = rrddim_add(st_tcpconnaborts, "TCPAbortOnTimeout", "timeout", 1, 1, RRD_ALGORITHM_INCREMENTAL);
555
+ rd_linger = rrddim_add(st_tcpconnaborts, "TCPAbortOnLinger", "linger", 1, 1, RRD_ALGORITHM_INCREMENTAL);
556
+ rd_failed = rrddim_add(st_tcpconnaborts, "TCPAbortFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
557
}
428
- else rrdset_next(st);
429
-
430
- rrddim_set(st, "TCPAbortOnData", tcpext_TCPAbortOnData);
431
- rrddim_set(st, "TCPAbortOnClose", tcpext_TCPAbortOnClose);
432
- rrddim_set(st, "TCPAbortOnMemory", tcpext_TCPAbortOnMemory);
433
- rrddim_set(st, "TCPAbortOnTimeout", tcpext_TCPAbortOnTimeout);
434
- rrddim_set(st, "TCPAbortOnLinger", tcpext_TCPAbortOnLinger);
435
- rrddim_set(st, "TCPAbortFailed", tcpext_TCPAbortFailed);
436
- rrdset_done(st);
558
+ else
559
+ rrdset_next(st_tcpconnaborts);
560
+
561
+ rrddim_set_by_pointer(st_tcpconnaborts, rd_baddata, tcpext_TCPAbortOnData);
562
+ rrddim_set_by_pointer(st_tcpconnaborts, rd_userclosed, tcpext_TCPAbortOnClose);
563
+ rrddim_set_by_pointer(st_tcpconnaborts, rd_nomemory, tcpext_TCPAbortOnMemory);
564
+ rrddim_set_by_pointer(st_tcpconnaborts, rd_timeout, tcpext_TCPAbortOnTimeout);
565
+ rrddim_set_by_pointer(st_tcpconnaborts, rd_linger, tcpext_TCPAbortOnLinger);
566
+ rrddim_set_by_pointer(st_tcpconnaborts, rd_failed, tcpext_TCPAbortFailed);
567
+
568
+ rrdset_done(st_tcpconnaborts);
569
}
570
+
571
// --------------------------------------------------------------------
572
573
if(do_tcpext_reorder == CONFIG_BOOLEAN_YES || (do_tcpext_reorder == CONFIG_BOOLEAN_AUTO && (tcpext_TCPRenoReorder || tcpext_TCPFACKReorder || tcpext_TCPSACKReorder || tcpext_TCPTSReorder))) {
574
do_tcpext_reorder = CONFIG_BOOLEAN_YES;
442
- st = rrdset_find_localhost("ipv4.tcpreorders");
443
- if(unlikely(!st)) {
444
- st = rrdset_create_localhost("ipv4", "tcpreorders", NULL, "tcp", NULL
445
- , "TCP Reordered Packets by Detection Method", "packets/s", 3020
446
- , update_every, RRDSET_TYPE_LINE);
447
-
448
- rrddim_add(st, "TCPTSReorder", "timestamp", 1, 1, RRD_ALGORITHM_INCREMENTAL);
449
- rrddim_add(st, "TCPSACKReorder", "sack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
450
- rrddim_add(st, "TCPFACKReorder", "fack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
451
- rrddim_add(st, "TCPRenoReorder", "reno", 1, 1, RRD_ALGORITHM_INCREMENTAL);
575
+
576
+ static RRDSET *st_tcpreorders = NULL;
577
+ static RRDDIM *rd_timestamp = NULL, *rd_sack = NULL, *rd_fack = NULL, *rd_reno = NULL;
578
+
579
+ if(unlikely(!st_tcpreorders)) {
580
+ st_tcpreorders = rrdset_create_localhost(
581
+ "ipv4"
582
+ , "tcpreorders"
583
+ , NULL
584
+ , "tcp"
585
+ , NULL
586
+ , "TCP Reordered Packets by Detection Method"
587
+ , "packets/s"
588
+ , 3020
589
+ , update_every
590
+ , RRDSET_TYPE_LINE
591
+ );
592
+
593
+ rd_timestamp = rrddim_add(st_tcpreorders, "TCPTSReorder", "timestamp", 1, 1, RRD_ALGORITHM_INCREMENTAL);
594
+ rd_sack = rrddim_add(st_tcpreorders, "TCPSACKReorder", "sack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
595
+ rd_fack = rrddim_add(st_tcpreorders, "TCPFACKReorder", "fack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
596
+ rd_reno = rrddim_add(st_tcpreorders, "TCPRenoReorder", "reno", 1, 1, RRD_ALGORITHM_INCREMENTAL);
597
}
453
- else rrdset_next(st);
598
+ else
599
+ rrdset_next(st_tcpreorders);
600
+
601
+ rrddim_set_by_pointer(st_tcpreorders, rd_timestamp, tcpext_TCPTSReorder);
602
+ rrddim_set_by_pointer(st_tcpreorders, rd_sack, tcpext_TCPSACKReorder);
603
+ rrddim_set_by_pointer(st_tcpreorders, rd_fack, tcpext_TCPFACKReorder);
604
+ rrddim_set_by_pointer(st_tcpreorders, rd_reno, tcpext_TCPRenoReorder);
605
455
- rrddim_set(st, "TCPTSReorder", tcpext_TCPTSReorder);
456
- rrddim_set(st, "TCPSACKReorder", tcpext_TCPSACKReorder);
457
- rrddim_set(st, "TCPFACKReorder", tcpext_TCPFACKReorder);
458
- rrddim_set(st, "TCPRenoReorder", tcpext_TCPRenoReorder);
459
- rrdset_done(st);
606
+ rrdset_done(st_tcpreorders);
607
}
608
609
// --------------------------------------------------------------------
610
611
if(do_tcpext_ofo == CONFIG_BOOLEAN_YES || (do_tcpext_ofo == CONFIG_BOOLEAN_AUTO && (tcpext_TCPOFOQueue || tcpext_TCPOFODrop || tcpext_TCPOFOMerge))) {
612
do_tcpext_ofo = CONFIG_BOOLEAN_YES;
466
- st = rrdset_find_localhost("ipv4.tcpofo");
467
- if(unlikely(!st)) {
468
- st = rrdset_create_localhost("ipv4", "tcpofo", NULL, "tcp", NULL, "TCP Out-Of-Order Queue"
469
- , "packets/s", 3050, update_every, RRDSET_TYPE_LINE);
470
-
471
- rrddim_add(st, "TCPOFOQueue", "inqueue", 1, 1, RRD_ALGORITHM_INCREMENTAL);
472
- rrddim_add(st, "TCPOFODrop", "dropped", -1, 1, RRD_ALGORITHM_INCREMENTAL);
473
- rrddim_add(st, "TCPOFOMerge", "merged", 1, 1, RRD_ALGORITHM_INCREMENTAL);
474
- rrddim_add(st, "OfoPruned", "pruned", -1, 1, RRD_ALGORITHM_INCREMENTAL);
613
+
614
+ static RRDSET *st_ipv4_tcpofo = NULL;
615
+ static RRDDIM *rd_inqueue = NULL, *rd_dropped = NULL, *rd_merged = NULL, *rd_pruned = NULL;
616
+
617
+ if(unlikely(!st_ipv4_tcpofo)) {
618
+
619
+ st_ipv4_tcpofo = rrdset_create_localhost(
620
+ "ipv4"
621
+ , "tcpofo"
622
+ , NULL
623
+ , "tcp"
624
+ , NULL
625
+ , "TCP Out-Of-Order Queue"
626
+ , "packets/s"
627
+ , 3050
628
+ , update_every
629
+ , RRDSET_TYPE_LINE
630
+ );
631
+
632
+ rd_inqueue = rrddim_add(st_ipv4_tcpofo, "TCPOFOQueue", "inqueue", 1, 1, RRD_ALGORITHM_INCREMENTAL);
633
+ rd_dropped = rrddim_add(st_ipv4_tcpofo, "TCPOFODrop", "dropped", -1, 1, RRD_ALGORITHM_INCREMENTAL);
634
+ rd_merged = rrddim_add(st_ipv4_tcpofo, "TCPOFOMerge", "merged", 1, 1, RRD_ALGORITHM_INCREMENTAL);
635
+ rd_pruned = rrddim_add(st_ipv4_tcpofo, "OfoPruned", "pruned", -1, 1, RRD_ALGORITHM_INCREMENTAL);
636
}
476
- else rrdset_next(st);
637
+ else
638
+ rrdset_next(st_ipv4_tcpofo);
639
478
- rrddim_set(st, "TCPOFOQueue", tcpext_TCPOFOQueue);
479
- rrddim_set(st, "TCPOFODrop", tcpext_TCPOFODrop);
480
- rrddim_set(st, "TCPOFOMerge", tcpext_TCPOFOMerge);
481
- rrddim_set(st, "OfoPruned", tcpext_OfoPruned);
482
- rrdset_done(st);
640
+ rrddim_set_by_pointer(st_ipv4_tcpofo, rd_inqueue, tcpext_TCPOFOQueue);
641
+ rrddim_set_by_pointer(st_ipv4_tcpofo, rd_dropped, tcpext_TCPOFODrop);
642
+ rrddim_set_by_pointer(st_ipv4_tcpofo, rd_merged, tcpext_TCPOFOMerge);
643
+ rrddim_set_by_pointer(st_ipv4_tcpofo, rd_pruned, tcpext_OfoPruned);
644
+
645
+ rrdset_done(st_ipv4_tcpofo);
646
}
647
648
// --------------------------------------------------------------------
649
650
if(do_tcpext_syscookies == CONFIG_BOOLEAN_YES || (do_tcpext_syscookies == CONFIG_BOOLEAN_AUTO && (tcpext_SyncookiesSent || tcpext_SyncookiesRecv || tcpext_SyncookiesFailed))) {
651
do_tcpext_syscookies = CONFIG_BOOLEAN_YES;
489
- st = rrdset_find_localhost("ipv4.tcpsyncookies");
490
- if(unlikely(!st)) {
491
- st = rrdset_create_localhost("ipv4", "tcpsyncookies", NULL, "tcp", NULL, "TCP SYN Cookies"
492
- , "packets/s", 3100, update_every, RRDSET_TYPE_LINE);
493
-
494
- rrddim_add(st, "SyncookiesRecv", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
495
- rrddim_add(st, "SyncookiesSent", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
496
- rrddim_add(st, "SyncookiesFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
652
+
653
+ static RRDSET *st_syncookies = NULL;
654
+ static RRDDIM *rd_received = NULL, *rd_sent = NULL, *rd_failed = NULL;
655
+
656
+ if(unlikely(!st_syncookies)) {
657
+
658
+ st_syncookies = rrdset_create_localhost(
659
+ "ipv4"
660
+ , "tcpsyncookies"
661
+ , NULL
662
+ , "tcp"
663
+ , NULL
664
+ , "TCP SYN Cookies"
665
+ , "packets/s"
666
+ , 3100
667
+ , update_every
668
+ , RRDSET_TYPE_LINE
669
+ );
670
+
671
+ rd_received = rrddim_add(st_syncookies, "SyncookiesRecv", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
672
+ rd_sent = rrddim_add(st_syncookies, "SyncookiesSent", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
673
+ rd_failed = rrddim_add(st_syncookies, "SyncookiesFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
674
}
498
- else rrdset_next(st);
675
+ else
676
+ rrdset_next(st_syncookies);
677
+
678
+ rrddim_set_by_pointer(st_syncookies, rd_received, tcpext_SyncookiesRecv);
679
+ rrddim_set_by_pointer(st_syncookies, rd_sent, tcpext_SyncookiesSent);
680
+ rrddim_set_by_pointer(st_syncookies, rd_failed, tcpext_SyncookiesFailed);
681
500
- rrddim_set(st, "SyncookiesRecv", tcpext_SyncookiesRecv);
501
- rrddim_set(st, "SyncookiesSent", tcpext_SyncookiesSent);
502
- rrddim_set(st, "SyncookiesFailed", tcpext_SyncookiesFailed);
503
- rrdset_done(st);
682
+ rrdset_done(st_syncookies);
683
}
684
685
}
src/proc_softirqs.c
+5
-2
@@ -140,7 +140,8 @@ int do_proc_softirqs(int update_every, usec_t dt) {
140
, update_every
141
, RRDSET_TYPE_STACKED
142
);
143
- else rrdset_next(st_system_softirqs);
143
+ else
144
+ rrdset_next(st_system_softirqs);
145
146
for(l = 0; l < lines ;l++) {
147
struct interrupt *irr = irrindex(irrs, l, cpus);
@@ -167,6 +168,7 @@ int do_proc_softirqs(int update_every, usec_t dt) {
168
169
rrddim_set_by_pointer(st_system_softirqs, irr->rd, irr->total);
170
}
171
+
172
rrdset_done(st_system_softirqs);
173
174
// --------------------------------------------------------------------
@@ -215,7 +217,8 @@ int do_proc_softirqs(int update_every, usec_t dt) {
217
, RRDSET_TYPE_STACKED
218
);
219
}
218
- else rrdset_next(core_st[c]);
220
+ else
221
+ rrdset_next(core_st[c]);
222
223
for(l = 0; l < lines ;l++) {
224
struct interrupt *irr = irrindex(irrs, l, cpus);
src/proc_stat.c
+61
-9
@@ -278,7 +278,18 @@ int do_proc_stat(int update_every, usec_t dt) {
278
}
279
}
280
281
- cpu_chart->st = rrdset_create_localhost(type, id, NULL, family, context, title, "percentage", priority, update_every, RRDSET_TYPE_STACKED);
281
+ cpu_chart->st = rrdset_create_localhost(
282
+ type
283
+ , id
284
+ , NULL
285
+ , family
286
+ , context
287
+ , title
288
+ , "percentage"
289
+ , priority
290
+ , update_every
291
+ , RRDSET_TYPE_STACKED
292
+ );
293
294
long multiplier = 1;
295
long divisor = 1; // sysconf(_SC_CLK_TCK);
@@ -317,8 +328,19 @@ int do_proc_stat(int update_every, usec_t dt) {
328
unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
329
330
if(unlikely(!st_intr)) {
320
- st_intr = rrdset_create_localhost("system", "intr", NULL, "interrupts", NULL, "CPU Interrupts"
321
- , "interrupts/s", 900, update_every, RRDSET_TYPE_LINE);
331
+ st_intr = rrdset_create_localhost(
332
+ "system"
333
+ , "intr"
334
+ , NULL
335
+ , "interrupts"
336
+ , NULL
337
+ , "CPU Interrupts"
338
+ , "interrupts/s"
339
+ , 900
340
+ , update_every
341
+ , RRDSET_TYPE_LINE
342
+ );
343
+
344
rrdset_flag_set(st_intr, RRDSET_FLAG_DETAIL);
345
346
rd_interrupts = rrddim_add(st_intr, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
@@ -336,8 +358,18 @@ int do_proc_stat(int update_every, usec_t dt) {
358
unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
359
360
if(unlikely(!st_ctxt)) {
339
- st_ctxt = rrdset_create_localhost("system", "ctxt", NULL, "processes", NULL, "CPU Context Switches"
340
- , "context switches/s", 800, update_every, RRDSET_TYPE_LINE);
361
+ st_ctxt = rrdset_create_localhost(
362
+ "system"
363
+ , "ctxt"
364
+ , NULL
365
+ , "processes"
366
+ , NULL
367
+ , "CPU Context Switches"
368
+ , "context switches/s"
369
+ , 800
370
+ , update_every
371
+ , RRDSET_TYPE_LINE
372
+ );
373
374
rd_switches = rrddim_add(st_ctxt, "switches", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
375
}
@@ -365,8 +397,18 @@ int do_proc_stat(int update_every, usec_t dt) {
397
static RRDDIM *rd_started = NULL;
398
399
if(unlikely(!st_forks)) {
368
- st_forks = rrdset_create_localhost("system", "forks", NULL, "processes", NULL, "Started Processes", "processes/s"
369
- , 700, update_every, RRDSET_TYPE_LINE);
400
+ st_forks = rrdset_create_localhost(
401
+ "system"
402
+ , "forks"
403
+ , NULL
404
+ , "processes"
405
+ , NULL
406
+ , "Started Processes"
407
+ , "processes/s"
408
+ , 700
409
+ , update_every
410
+ , RRDSET_TYPE_LINE
411
+ );
412
rrdset_flag_set(st_forks, RRDSET_FLAG_DETAIL);
413
414
rd_started = rrddim_add(st_forks, "started", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
@@ -385,8 +427,18 @@ int do_proc_stat(int update_every, usec_t dt) {
427
static RRDDIM *rd_blocked = NULL;
428
429
if(unlikely(!st_processes)) {
388
- st_processes = rrdset_create_localhost("system", "processes", NULL, "processes", NULL, "System Processes", "processes"
389
- , 600, update_every, RRDSET_TYPE_LINE);
430
+ st_processes = rrdset_create_localhost(
431
+ "system"
432
+ , "processes"
433
+ , NULL
434
+ , "processes"
435
+ , NULL
436
+ , "System Processes"
437
+ , "processes"
438
+ , 600
439
+ , update_every
440
+ , RRDSET_TYPE_LINE
441
+ );
442
443
rd_running = rrddim_add(st_processes, "running", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
444
rd_blocked = rrddim_add(st_processes, "blocked", NULL, -1, 1, RRD_ALGORITHM_ABSOLUTE);
src/proc_uptime.c
+21
-8
@@ -3,7 +3,6 @@
3
int do_proc_uptime(int update_every, usec_t dt) {
4
(void)dt;
5
6
- static RRDSET *st = NULL;
6
collected_number uptime = 0;
7
8
#ifdef CLOCK_BOOTTIME_IS_AVAILABLE
@@ -38,17 +37,31 @@ int do_proc_uptime(int update_every, usec_t dt) {
37
38
// --------------------------------------------------------------------
39
41
- if(unlikely(!st))
42
- st = rrdset_find_localhost("system.uptime");
40
+ static RRDSET *st = NULL;
41
+ static RRDDIM *rd = NULL;
42
43
if(unlikely(!st)) {
45
- st = rrdset_create_localhost("system", "uptime", NULL, "uptime", NULL, "System Uptime", "seconds", 1000
46
- , update_every, RRDSET_TYPE_LINE);
47
- rrddim_add(st, "uptime", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
44
+
45
+ st = rrdset_create_localhost(
46
+ "system"
47
+ , "uptime"
48
+ , NULL
49
+ , "uptime"
50
+ , NULL
51
+ , "System Uptime"
52
+ , "seconds"
53
+ , 1000
54
+ , update_every
55
+ , RRDSET_TYPE_LINE
56
+ );
57
+
58
+ rd = rrddim_add(st, "uptime", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
59
}
49
- else rrdset_next(st);
60
+ else
61
+ rrdset_next(st);
62
+
63
+ rrddim_set_by_pointer(st, rd, uptime);
64
51
- rrddim_set(st, "uptime", uptime);
65
rrdset_done(st);
66
67
return 0;
src/sys_devices_system_edac_mc.c
+39
-22
@@ -27,7 +27,7 @@ static void find_all_mc() {
27
char *dirname = config_get("plugin:proc:/sys/devices/system/edac/mc", "directory to monitor", name);
28
29
DIR *dir = opendir(dirname);
30
- if(!dir) {
30
+ if(unlikely(!dir)) {
31
error("Cannot read ECC memory errors directory '%s'", dirname);
32
return;
33
}
@@ -132,21 +132,30 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
132
static RRDSET *ce_st = NULL;
133
134
if(unlikely(!ce_st)) {
135
- ce_st = rrdset_find_localhost("mem.ecc_ce");
136
- if(unlikely(!ce_st))
137
- ce_st = rrdset_create_localhost("mem", "ecc_ce", NULL, "ecc", NULL, "ECC Memory Correctable Errors"
138
- , "errors", 6600, update_every, RRDSET_TYPE_LINE);
139
-
140
- for(m = mc_root; m; m = m->next)
141
- if(m->ce_count_filename)
142
- m->ce_rd = rrddim_add(ce_st, m->name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
135
+ ce_st = rrdset_create_localhost(
136
+ "mem"
137
+ , "ecc_ce"
138
+ , NULL
139
+ , "ecc"
140
+ , NULL
141
+ , "ECC Memory Correctable Errors"
142
+ , "errors"
143
+ , 6600
144
+ , update_every
145
+ , RRDSET_TYPE_LINE
146
+ );
147
}
148
else
149
rrdset_next(ce_st);
150
147
- for(m = mc_root; m; m = m->next)
148
- if(m->ce_count_filename && m->ce_updated)
151
+ for(m = mc_root; m; m = m->next) {
152
+ if (m->ce_count_filename && m->ce_updated) {
153
+ if(unlikely(!m->ce_rd))
154
+ m->ce_rd = rrddim_add(ce_st, m->name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
155
+
156
rrddim_set_by_pointer(ce_st, m->ce_rd, m->ce_count);
157
+ }
158
+ }
159
160
rrdset_done(ce_st);
161
}
@@ -159,22 +168,30 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
168
static RRDSET *ue_st = NULL;
169
170
if(unlikely(!ue_st)) {
162
- ue_st = rrdset_find_localhost("mem.ecc_ue");
163
-
164
- if(unlikely(!ue_st))
165
- ue_st = rrdset_create_localhost("mem", "ecc_ue", NULL, "ecc", NULL, "ECC Memory Uncorrectable Errors"
166
- , "errors", 6610, update_every, RRDSET_TYPE_LINE);
167
-
168
- for(m = mc_root; m; m = m->next)
169
- if(m->ue_count_filename)
170
- m->ue_rd = rrddim_add(ue_st, m->name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
171
+ ue_st = rrdset_create_localhost(
172
+ "mem"
173
+ , "ecc_ue"
174
+ , NULL
175
+ , "ecc"
176
+ , NULL
177
+ , "ECC Memory Uncorrectable Errors"
178
+ , "errors"
179
+ , 6610
180
+ , update_every
181
+ , RRDSET_TYPE_LINE
182
+ );
183
}
184
else
185
rrdset_next(ue_st);
186
175
- for(m = mc_root; m; m = m->next)
176
- if(m->ue_count_filename && m->ue_updated)
187
+ for(m = mc_root; m; m = m->next) {
188
+ if (m->ue_count_filename && m->ue_updated) {
189
+ if(unlikely(!m->ue_rd))
190
+ m->ue_rd = rrddim_add(ue_st, m->name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
191
+
192
rrddim_set_by_pointer(ue_st, m->ue_rd, m->ue_count);
193
+ }
194
+ }
195
196
rrdset_done(ue_st);
197
}
src/sys_kernel_mm_ksm.c
+1
-1
@@ -85,7 +85,7 @@ int do_sys_kernel_mm_ksm(int update_every, usec_t dt) {
85
offered = pages_sharing + pages_shared + pages_unshared + pages_volatile;
86
saved = pages_sharing - pages_shared;
87
88
- if(!offered || !pages_to_scan) return 0;
88
+ if(unlikely(!offered || !pages_to_scan)) return 0;
89
90
// --------------------------------------------------------------------
91