reduce CPU usage using sleep in main loop
authorAlexey Chernobaev <achernobaev@dev.rtsoft.ru>
Wed, 29 Aug 2018 10:37:06 +0000 (13:37 +0300)
committerAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Mon, 3 Sep 2018 15:21:42 +0000 (18:21 +0300)
profctl.c

index 7381088..5cc9020 100644 (file)
--- a/profctl.c
+++ b/profctl.c
@@ -718,6 +718,8 @@ int main(int argc, char **argv)
                {
                        break; // data output thread finished
                }
+               // sleep to reduce CPU usage
+               usleep(100 * 1000); // 100 msec
        }
        if (verbose && !global_stop) {
                log_message("stop flag set (main)");