From: Carl Hetherington Date: Mon, 1 Oct 2012 23:28:07 +0000 (+0100) Subject: Some more timing logging. X-Git-Tag: v2.0.48~1718^2~13 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=fc09f6798fc05d100e6a5fbf3e9b1f811be0ef46;p=dcpomatic.git Some more timing logging. --- diff --git a/src/lib/j2k_wav_encoder.cc b/src/lib/j2k_wav_encoder.cc index 4deedc388..0d786ab04 100644 --- a/src/lib/j2k_wav_encoder.cc +++ b/src/lib/j2k_wav_encoder.cc @@ -145,11 +145,16 @@ J2KWAVEncoder::encoder_thread (ServerDescription* server) int remote_backoff = 0; while (1) { + + { + stringstream s; + s << "Encoder thread " << pthread_self() << " sleeps."; + _log->microsecond_log (s.str(), Log::TIMING); + } + boost::mutex::scoped_lock lock (_worker_mutex); while (_queue.empty () && !_process_end) { - _log->microsecond_log ("Encoder thread sleeps", Log::TIMING); _worker_condition.wait (lock); - _log->microsecond_log ("Encoder thread wakes", Log::TIMING); } if (_process_end) { @@ -157,7 +162,13 @@ J2KWAVEncoder::encoder_thread (ServerDescription* server) } boost::shared_ptr vf = _queue.front (); - _log->microsecond_log ("Encoder thread wakes with queue of " + boost::lexical_cast (_queue.size ()), Log::TIMING); + + { + stringstream s; + s << "Encoder thread " << pthread_self() << " wakes with queue of " << _queue.size(); + _log->microsecond_log (s.str(), Log::TIMING); + } + _queue.pop_front (); lock.unlock (); @@ -189,9 +200,19 @@ J2KWAVEncoder::encoder_thread (ServerDescription* server) } else { try { - _log->microsecond_log ("Encoder thread begins local encode of " + lexical_cast (vf->frame ()), Log::TIMING); + { + stringstream s; + s << "Encoder thread " << pthread_self() << " begins local encode of " << vf->frame(); + _log->microsecond_log (s.str(), Log::TIMING); + } + encoded = vf->encode_locally (); - _log->microsecond_log ("Encoder thread finishes local encode of " + lexical_cast (vf->frame ()), Log::TIMING); + + { + stringstream s; + s << "Encoder thread " << pthread_self() << " finishes local encode of " << vf->frame(); + _log->microsecond_log (s.str(), Log::TIMING); + } } catch (std::exception& e) { stringstream s; s << "Local encode failed " << e.what() << ".";