convert apps_plugin to heartbeat API
Signed-off-by: Rémi Lefèvre <remi.lefevre@parrot.com>
Rémi Lefèvre committed
Dec 13, 2016 at 18:18 UTC
e2ecbe4e473988da5387fcd018def79bc11fed77
1 file changed
+3
-6
src/apps_plugin.c
+3
-6
@@ -2903,9 +2903,9 @@ int main(int argc, char **argv)
2903
2904
usec_t step = update_every * USEC_PER_SEC;
2905
global_iterations_counter = 1;
2906
+ heartbeat_t hb;
2907
+ heartbeat_init(&hb);
2908
for(;1; global_iterations_counter++) {
2907
- usec_t now = now_realtime_usec();
2908
- usec_t next = now - (now % step) + step;
2909
2910
#ifdef NETDATA_PROFILING
2911
#warning "compiling for profiling"
@@ -2913,10 +2913,7 @@ int main(int argc, char **argv)
2913
profiling_count++;
2914
if(unlikely(profiling_count > 1000)) exit(0);
2915
#else
2916
- while(now < next) {
2917
- sleep_usec(next - now);
2918
- now = now_realtime_usec();
2919
- }
2916
+ heartbeat_next(&hb, step);
2917
#endif
2918
2919
if(!collect_data_for_all_processes_from_proc()) {