]> arthur.barton.de Git - netdata.git/blobdiff - src/sys_fs_cgroup.c
Initial "Debianization"
[netdata.git] / src / sys_fs_cgroup.c
index 2b7254f47aa3b34607328b0d9d8143db42d19462..faeb7c930c6d8189af7483196a659f07cdb48a1a 100644 (file)
@@ -145,6 +145,7 @@ void read_cgroup_plugin_configuration() {
 
     enabled_cgroup_patterns = simple_pattern_create(
             config_get("plugin:cgroups", "enable by default cgroups matching",
+                    " /system.slice/docker-*.scope "
                     " !*.mount "
                     " !*.partition "
                     " !*.scope "
@@ -180,6 +181,8 @@ void read_cgroup_plugin_configuration() {
 
     enabled_cgroup_renames = simple_pattern_create(
             config_get("plugin:cgroups", "run script to rename cgroups matching",
+                    " *docker* "
+                    " *lxc* "
                     " !/ "
                     " !*.mount "
                     " !*.partition "
@@ -2079,24 +2082,20 @@ void *cgroups_main(void *ptr) {
 
     RRDSET *stcpu_thread = NULL;
 
+    heartbeat_t hb;
+    heartbeat_init(&hb);
     usec_t step = cgroup_update_every * USEC_PER_SEC;
-    usec_t find_every = cgroup_check_for_new_every * USEC_PER_SEC, find_next = 0;
+    usec_t find_every = cgroup_check_for_new_every * USEC_PER_SEC, find_dt = 0;
     for(;;) {
-        usec_t now = now_monotonic_usec();
-        usec_t next = now - (now % step) + step;
-
-        while(now < next) {
-            sleep_usec(next - now);
-            now = now_monotonic_usec();
-        }
-
+        usec_t hb_dt = heartbeat_next(&hb, step);
         if(unlikely(netdata_exit)) break;
 
         // BEGIN -- the job to be done
 
-        if(unlikely(now >= find_next)) {
+        find_dt += hb_dt;
+        if(unlikely(find_dt >= find_every)) {
             find_all_cgroups();
-            find_next = now + find_every;
+            find_dt = 0;
         }
 
         read_all_cgroups(cgroup_root);