master - test: Avoid sleeps in the runner monitoring loop.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e8cc9254e038b59bb6cc5ec9ba7793f9a82ab150 Commit: e8cc9254e038b59bb6cc5ec9ba7793f9a82ab150 Parent: 48275c78361578672f5f3f5c29737404cf159f6d Author: Petr Rockai <[email protected]> AuthorDate: Fri Jun 27 23:17:47 2014 +0200 Committer: Petr Rockai <[email protected]> CommitterDate: Thu Feb 5 13:47:18 2015 +0100
test: Avoid sleeps in the runner monitoring loop.
--- test/lib/runner.cpp | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
test/lib/runner.cpp +8 -4
@@ -115,7 +115,7 @@ struct TestCase { bool timeout; pid_t pid; - time_t start, end, silent_start; + time_t start, end, silent_start, last_update; Options options; Journal *journal;
@@ -175,13 +175,17 @@ struct TestCase { wait.tv_sec = 0; wait.tv_usec = 500000; /* timeout 0.5s */ - if ( !options.verbose && !options.interactive && !options.batch ) - progress( Update ) << tag( "running" ) << pretty() << " " << end - start << std::flush; + if ( !options.verbose && !options.interactive && !options.batch ) { + if ( end - last_update >= 1 ) { + progress( Update ) << tag( "running" ) << pretty() << " " + << end - start << std::flush; + last_update = end; + } + } if ( select( io.fd + 1, &set, NULL, NULL, &wait ) > 0 ) silent_start = end; /* something happened */ - usleep(500000); io.sync(); return true;