summaryrefslogtreecommitdiffstats
path: root/src/plugin_proc.c
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2016-05-25 10:36:24 +0000
committerLennart Weller <lhw@ring0.de>2016-05-25 10:36:24 +0000
commitb4f64f72a3e4bf590c60b0cbd6cd365aa1a58542 (patch)
treee6706c727a1fedb44da614453ad3e429a7403a9b /src/plugin_proc.c
parentImported Upstream version 1.1.0 (diff)
downloadnetdata-b4f64f72a3e4bf590c60b0cbd6cd365aa1a58542.tar.xz
netdata-b4f64f72a3e4bf590c60b0cbd6cd365aa1a58542.zip
Imported Upstream version 1.2.0upstream/1.2.0
Diffstat (limited to 'src/plugin_proc.c')
-rw-r--r--src/plugin_proc.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/plugin_proc.c b/src/plugin_proc.c
index 4cd20afc5..a147d971f 100644
--- a/src/plugin_proc.c
+++ b/src/plugin_proc.c
@@ -14,12 +14,7 @@
#include "rrd.h"
#include "plugin_proc.h"
#include "main.h"
-
-unsigned long long sutime() {
- struct timeval now;
- gettimeofday(&now, NULL);
- return now.tv_sec * 1000000ULL + now.tv_usec;
-}
+#include "registry.h"
void *proc_main(void *ptr)
{
@@ -88,11 +83,11 @@ void *proc_main(void *ptr)
if(unlikely(netdata_exit)) break;
// delay until it is our time to run
- while((sunow = sutime()) < sunext)
+ while((sunow = timems()) < sunext)
usleep((useconds_t)(sunext - sunow));
// find the next time we need to run
- while(sutime() > sunext)
+ while(timems() > sunext)
sunext += rrd_update_every * 1000000ULL;
if(unlikely(netdata_exit)) break;
@@ -102,7 +97,7 @@ void *proc_main(void *ptr)
if(!vdo_sys_kernel_mm_ksm) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_sys_kernel_mm_ksm().");
- sunow = sutime();
+ sunow = timems();
vdo_sys_kernel_mm_ksm = do_sys_kernel_mm_ksm(rrd_update_every, (sutime_sys_kernel_mm_ksm > 0)?sunow - sutime_sys_kernel_mm_ksm:0ULL);
sutime_sys_kernel_mm_ksm = sunow;
}
@@ -110,7 +105,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_loadavg) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_loadavg().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_loadavg = do_proc_loadavg(rrd_update_every, (sutime_proc_loadavg > 0)?sunow - sutime_proc_loadavg:0ULL);
sutime_proc_loadavg = sunow;
}
@@ -118,7 +113,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_interrupts) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_interrupts().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_interrupts = do_proc_interrupts(rrd_update_every, (sutime_proc_interrupts > 0)?sunow - sutime_proc_interrupts:0ULL);
sutime_proc_interrupts = sunow;
}
@@ -126,7 +121,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_softirqs) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_softirqs().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_softirqs = do_proc_softirqs(rrd_update_every, (sutime_proc_softirqs > 0)?sunow - sutime_proc_softirqs:0ULL);
sutime_proc_softirqs = sunow;
}
@@ -134,7 +129,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_sys_kernel_random_entropy_avail) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_sys_kernel_random_entropy_avail().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_sys_kernel_random_entropy_avail = do_proc_sys_kernel_random_entropy_avail(rrd_update_every, (sutime_proc_sys_kernel_random_entropy_avail > 0)?sunow - sutime_proc_sys_kernel_random_entropy_avail:0ULL);
sutime_proc_sys_kernel_random_entropy_avail = sunow;
}
@@ -142,7 +137,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_dev) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_dev().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_dev = do_proc_net_dev(rrd_update_every, (sutime_proc_net_dev > 0)?sunow - sutime_proc_net_dev:0ULL);
sutime_proc_net_dev = sunow;
}
@@ -150,7 +145,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_diskstats) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_diskstats().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_diskstats = do_proc_diskstats(rrd_update_every, (sutime_proc_diskstats > 0)?sunow - sutime_proc_diskstats:0ULL);
sutime_proc_diskstats = sunow;
}
@@ -158,7 +153,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_snmp) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_snmp().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_snmp = do_proc_net_snmp(rrd_update_every, (sutime_proc_net_snmp > 0)?sunow - sutime_proc_net_snmp:0ULL);
sutime_proc_net_snmp = sunow;
}
@@ -166,7 +161,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_snmp6) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_snmp6().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_snmp6 = do_proc_net_snmp6(rrd_update_every, (sutime_proc_net_snmp6 > 0)?sunow - sutime_proc_net_snmp6:0ULL);
sutime_proc_net_snmp6 = sunow;
}
@@ -174,7 +169,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_netstat) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_netstat().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_netstat = do_proc_net_netstat(rrd_update_every, (sutime_proc_net_netstat > 0)?sunow - sutime_proc_net_netstat:0ULL);
sutime_proc_net_netstat = sunow;
}
@@ -182,7 +177,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_stat_conntrack) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_stat_conntrack().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_stat_conntrack = do_proc_net_stat_conntrack(rrd_update_every, (sutime_proc_net_stat_conntrack > 0)?sunow - sutime_proc_net_stat_conntrack:0ULL);
sutime_proc_net_stat_conntrack = sunow;
}
@@ -190,7 +185,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_ip_vs_stats) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling vdo_proc_net_ip_vs_stats().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_ip_vs_stats = do_proc_net_ip_vs_stats(rrd_update_every, (sutime_proc_net_ip_vs_stats > 0)?sunow - sutime_proc_net_ip_vs_stats:0ULL);
sutime_proc_net_ip_vs_stats = sunow;
}
@@ -198,7 +193,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_stat_synproxy) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling vdo_proc_net_stat_synproxy().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_stat_synproxy = do_proc_net_stat_synproxy(rrd_update_every, (sutime_proc_net_stat_synproxy > 0)?sunow - sutime_proc_net_stat_synproxy:0ULL);
sutime_proc_net_stat_synproxy = sunow;
}
@@ -206,7 +201,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_stat) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_stat().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_stat = do_proc_stat(rrd_update_every, (sutime_proc_stat > 0)?sunow - sutime_proc_stat:0ULL);
sutime_proc_stat = sunow;
}
@@ -214,7 +209,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_meminfo) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling vdo_proc_meminfo().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_meminfo = do_proc_meminfo(rrd_update_every, (sutime_proc_meminfo > 0)?sunow - sutime_proc_meminfo:0ULL);
sutime_proc_meminfo = sunow;
}
@@ -222,7 +217,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_vmstat) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling vdo_proc_vmstat().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_vmstat = do_proc_vmstat(rrd_update_every, (sutime_proc_vmstat > 0)?sunow - sutime_proc_vmstat:0ULL);
sutime_proc_vmstat = sunow;
}
@@ -230,7 +225,7 @@ void *proc_main(void *ptr)
if(!vdo_proc_net_rpc_nfsd) {
debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_rpc_nfsd().");
- sunow = sutime();
+ sunow = timems();
vdo_proc_net_rpc_nfsd = do_proc_net_rpc_nfsd(rrd_update_every, (sutime_proc_net_rpc_nfsd > 0)?sunow - sutime_proc_net_rpc_nfsd:0ULL);
sutime_proc_net_rpc_nfsd = sunow;
}
@@ -246,7 +241,7 @@ void *proc_main(void *ptr)
if(!stcpu_thread) stcpu_thread = rrdset_find("netdata.plugin_proc_cpu");
if(!stcpu_thread) {
- stcpu_thread = rrdset_create("netdata", "plugin_proc_cpu", NULL, "proc.internal", NULL, "NetData Proc Plugin CPU usage", "milliseconds/s", 131000, rrd_update_every, RRDSET_TYPE_STACKED);
+ stcpu_thread = rrdset_create("netdata", "plugin_proc_cpu", NULL, "proc.internal", NULL, "NetData Proc Plugin CPU usage", "milliseconds/s", 132000, rrd_update_every, RRDSET_TYPE_STACKED);
rrddim_add(stcpu_thread, "user", NULL, 1, 1000, RRDDIM_INCREMENTAL);
rrddim_add(stcpu_thread, "system", NULL, 1, 1000, RRDDIM_INCREMENTAL);
@@ -276,7 +271,7 @@ void *proc_main(void *ptr)
if(!stclients) stclients = rrdset_find("netdata.clients");
if(!stclients) {
- stclients = rrdset_create("netdata", "clients", NULL, "netdata", NULL, "NetData Web Clients", "connected clients", 131000, rrd_update_every, RRDSET_TYPE_LINE);
+ stclients = rrdset_create("netdata", "clients", NULL, "netdata", NULL, "NetData Web Clients", "connected clients", 130100, rrd_update_every, RRDSET_TYPE_LINE);
rrddim_add(stclients, "clients", NULL, 1, 1, RRDDIM_ABSOLUTE);
}
@@ -289,7 +284,7 @@ void *proc_main(void *ptr)
if(!streqs) streqs = rrdset_find("netdata.requests");
if(!streqs) {
- streqs = rrdset_create("netdata", "requests", NULL, "netdata", NULL, "NetData Web Requests", "requests/s", 131100, rrd_update_every, RRDSET_TYPE_LINE);
+ streqs = rrdset_create("netdata", "requests", NULL, "netdata", NULL, "NetData Web Requests", "requests/s", 130200, rrd_update_every, RRDSET_TYPE_LINE);
rrddim_add(streqs, "requests", NULL, 1, 1, RRDDIM_INCREMENTAL);
}
@@ -302,7 +297,7 @@ void *proc_main(void *ptr)
if(!stbytes) stbytes = rrdset_find("netdata.net");
if(!stbytes) {
- stbytes = rrdset_create("netdata", "net", NULL, "netdata", NULL, "NetData Network Traffic", "kilobits/s", 131200, rrd_update_every, RRDSET_TYPE_AREA);
+ stbytes = rrdset_create("netdata", "net", NULL, "netdata", NULL, "NetData Network Traffic", "kilobits/s", 130300, rrd_update_every, RRDSET_TYPE_AREA);
rrddim_add(stbytes, "in", NULL, 8, 1024, RRDDIM_INCREMENTAL);
rrddim_add(stbytes, "out", NULL, -8, 1024, RRDDIM_INCREMENTAL);
@@ -312,6 +307,10 @@ void *proc_main(void *ptr)
rrddim_set(stbytes, "in", global_statistics.bytes_received);
rrddim_set(stbytes, "out", global_statistics.bytes_sent);
rrdset_done(stbytes);
+
+ // ----------------------------------------------------------------
+
+ registry_statistics();
}
}