[x265] [PATCH 06 of 13] stats: count the number of times top dependencies block worker threads

Steve Borho steve at borho.org
Wed Jan 28 21:32:21 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1422469978 21600
#      Wed Jan 28 12:32:58 2015 -0600
# Node ID 6cd6e04a0abd944aec2efdaf987fa087f1a74497
# Parent  0c5078dfd9c552d3788f5d8cafb13095000169f0
stats: count the number of times top dependencies block worker threads

diff -r 0c5078dfd9c5 -r 6cd6e04a0abd source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Jan 28 12:28:49 2015 -0600
+++ b/source/encoder/encoder.cpp	Wed Jan 28 12:32:58 2015 -0600
@@ -216,7 +216,7 @@
                     fprintf(m_csvfpt, "Y PSNR, U PSNR, V PSNR, YUV PSNR, SSIM, SSIM (dB), "
                                       "List 0, List 1");
                     /* detailed performance statistics */
-                    fprintf(m_csvfpt, ", Wall time, Total CTU time, Avg WPP\n");
+                    fprintf(m_csvfpt, ", Wall time, Total CTU time, Avg WPP, Row Blocks\n");
                 }
                 else
                     fputs(summaryCSVHeader, m_csvfpt);
@@ -1195,6 +1195,7 @@
                 fprintf(m_csvfpt, ", %.3lf", (double)curEncoder->m_totalActiveWorkerCount / curEncoder->m_activeWorkerCountSamples);
             else
                 fputs(", 1", m_csvfpt);
+            fprintf(m_csvfpt, ", %d", curEncoder->m_countRowBlocks);
             fprintf(m_csvfpt, "\n");
         }
 
diff -r 0c5078dfd9c5 -r 6cd6e04a0abd source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Jan 28 12:28:49 2015 -0600
+++ b/source/encoder/frameencoder.cpp	Wed Jan 28 12:32:58 2015 -0600
@@ -239,6 +239,7 @@
     m_totalActiveWorkerCount = 0;
     m_activeWorkerCountSamples = 0;
     m_totalWorkerElapsedTime = 0;
+    m_countRowBlocks = 0;
 
     /* Emit access unit delimiter unless this is the first frame and the user is
      * not repeating headers (since AUD is supposed to be the first NAL in the access
@@ -938,6 +939,7 @@
             curRow.active = false;
             curRow.busy = false;
             m_totalWorkerElapsedTime += x265_mdate() - startTime; // not thread safe, but good enough
+            ATOMIC_INC(&m_countRowBlocks);
             return;
         }
     }
diff -r 0c5078dfd9c5 -r 6cd6e04a0abd source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h	Wed Jan 28 12:28:49 2015 -0600
+++ b/source/encoder/frameencoder.h	Wed Jan 28 12:32:58 2015 -0600
@@ -166,6 +166,7 @@
     volatile int             m_activeWorkerCount;        // count of workers current encoding or filtering CTUs
     volatile int             m_totalActiveWorkerCount;   // sum of m_activeWorkerCount sampled at end of each CTU
     volatile int             m_activeWorkerCountSamples; // count of times m_activeWorkerCount was sampled (think vbv restarts)
+    volatile int             m_countRowBlocks;           // count of workers forced to abandon a row because of top dependency
     int64_t                  m_startCompressTime;        // timestamp when frame encoder is given a frame
     int64_t                  m_row0WaitTime;             // timestamp when row 0 is allowed to start
     int64_t                  m_endCompressTime;          // timestamp after all CTUs are compressed


More information about the x265-devel mailing list