More timing tweaks.
authorCarl Hetherington <cth@carlh.net>
Wed, 19 Aug 2015 10:58:21 +0000 (11:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 19 Aug 2015 10:58:21 +0000 (11:58 +0100)
hacks/analog.py
src/lib/dcp_video.cc

index fa12460141b46c8bc0be45e539761e5d9b9659a1..de5a319c482df6a176cbde64d6ffb68e10285bfd 100644 (file)
@@ -109,7 +109,7 @@ while True:
     # Not-so-human-readable log messages (LOG_TIMING)
     if message == 'add-frame-to-queue':
         queue_size.append((T, values['queue']))
-    elif message in ['encoder-sleep', 'encoder-wake', 'start-local-encode', 'finish-local-encode', 'start-remote-send', 'finish-remote-send', 'start-remote-encode-and-receive', 'finish-remote-encode-and-receive']:
+    elif message in ['encoder-sleep', 'encoder-wake', 'start-local-encode', 'finish-local-encode', 'start-remote-send', 'start-remote-encode', 'start-remote-receive', 'finish-remote-receive']:
         add_encoder_thread_event(values['thread'], T, message)
     # Human-readable log message (other LOG_*)
     elif message.startswith('Finished locally-encoded'):
@@ -238,13 +238,13 @@ elif args.encoder_stats:
     for t in encoder_threads:
         last = None
         asleep = Time()
-        encoding = Time()
+        local_encoding = Time()
         sending = Time()
-        remote_encoding_and_receiving = Time()
+        remote_encoding = Time()
+        receiving = Time()
         wakes = 0
         for e in encoder_thread_events[t]:
-            if e[1] not in ['encoder-sleep', 'encoder-wake', 'start-remote-send', 'finish-remote-send',
-                            'start-remote-encode-and-receive', 'finish-remote-encode-and-receive']:
+            if e[1] not in ['encoder-sleep', 'encoder-wake', 'start-remote-send', 'start-remote-encode', 'start-remote-receive', 'finish-remote-receive']:
                 continue
 
             if last is not None:
@@ -252,21 +252,28 @@ elif args.encoder_stats:
                     asleep += e[0] - last[0]
                 elif last[1] == 'encoder-wake':
                     wakes += 1
-                    encoding += e[0] - last[0]
+                    local_encoding += e[0] - last[0]
                 elif last[1] == 'start-remote-send':
                     sending += e[0] - last[0]
-                elif last[1] == 'start-remote-encode-and-receive':
-                    remote_encoding_and_receiving += e[0] - last[0]
+                elif last[1] == 'start-remote-encode':
+                    remote_encoding += e[0] - last[0]
+                elif last[1] == 'start-remote-receive':
+                    receiving += e[0] - last[0]
 
             last = e
 
         print '-- Encoder thread %s' % t
         print '\tAwoken %d times' % wakes
-        total = asleep.float_seconds() + encoding.float_seconds() + sending.float_seconds() + remote_encoding_and_receiving.float_seconds()
+        total = asleep.float_seconds() + local_encoding.float_seconds() + sending.float_seconds() + remote_encoding.float_seconds() + receiving.float_seconds()
         if total == 0:
             continue
         print '\tAsleep: %s (%.2f%%)' % (asleep, asleep.float_seconds() * 100 / total)
-        print '\tEncoding: %s (%.2f%%)' % (encoding, encoding.float_seconds() * 100 / total)
-        print '\tSending: %s (%.2f%%)' % (sending, sending.float_seconds() * 100 / total)
-        print '\tRemote encoding / receiving: %s (%.2f%%)' % (remote_encoding_and_receiving, remote_encoding_and_receiving.float_seconds() * 100 / total)
+        if local_encoding.float_seconds() > 0:
+            print '\tLocal encoding: %s (%.2f%%)' % (local_encoding, local_encoding.float_seconds() * 100 / total)
+        if sending.float_seconds() > 0:
+            print '\tSending: %s (%.2f%%)' % (sending, sending.float_seconds() * 100 / total)
+        if remote_encoding.float_seconds() > 0:
+            print '\tRemote encoding: %s (%.2f%%)' % (remote_encoding, remote_encoding.float_seconds() * 100 / total)
+        if receiving.float_seconds() > 0:
+            print '\tReceiving: %s (%.2f%%)' % (receiving, receiving.float_seconds() * 100 / total)
         print ''
index 7d060b30da180434d683a7baf15c9a7dff4dfcd2..f4c6222e2cfc2ff74d003ffc0b0ed6221bd9ad3a 100644 (file)
@@ -268,15 +268,15 @@ DCPVideo::encode_remotely (ServerDescription serv)
        /* Send binary data */
        LOG_TIMING("start-remote-send thread=%1", boost::this_thread::get_id());
        _frame->send_binary (socket);
-       LOG_TIMING("finish-remote-send thread=%1", boost::this_thread::get_id());
 
        /* Read the response (JPEG2000-encoded data); this blocks until the data
           is ready and sent back.
        */
-       LOG_TIMING("start-remote-encode-and-receive thread=%1", boost::this_thread::get_id ());
+       LOG_TIMING("start-remote-encode thread=%1", boost::this_thread::get_id ());
        Data e (socket->read_uint32 ());
+       LOG_TIMING("start-remote-receive thread=%1", boost::this_thread::get_id ());
        socket->read (e.data().get(), e.size());
-       LOG_TIMING("finish-remote-encode-and-receive thread=%1", boost::this_thread::get_id ());
+       LOG_TIMING("finish-remote-receive thread=%1", boost::this_thread::get_id ());
 
        LOG_DEBUG_ENCODE (N_("Finished remotely-encoded frame %1"), _index);