3 void *freebsd_main(void *ptr) {
4 struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
6 info("FREEBSD Plugin thread created with task id %d", gettid());
8 if(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) != 0)
9 error("Cannot set pthread cancel type to DEFERRED.");
11 if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
12 error("Cannot set pthread cancel state to ENABLE.");
14 // when ZERO, attempt to do it
15 int vdo_cpu_netdata = !config_get_boolean("plugin:freebsd", "netdata server resources", 1);
16 int vdo_freebsd_sysctl = !config_get_boolean("plugin:freebsd", "sysctl", 1);
18 // keep track of the time each module was called
19 unsigned long long sutime_freebsd_sysctl = 0ULL;
21 usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
25 usec_t hb_dt = heartbeat_next(&hb, step);
27 if(unlikely(netdata_exit)) break;
29 // BEGIN -- the job to be done
31 if(!vdo_freebsd_sysctl) {
32 debug(D_PROCNETDEV_LOOP, "FREEBSD: calling do_freebsd_sysctl().");
33 vdo_freebsd_sysctl = do_freebsd_sysctl(localhost->rrd_update_every, hb_dt);
35 if(unlikely(netdata_exit)) break;
37 // END -- the job is done
39 // --------------------------------------------------------------------
41 if(!vdo_cpu_netdata) {
42 global_statistics_charts();
43 registry_statistics();
47 info("FREEBSD thread exiting");
49 static_thread->enabled = 0;