Browse Source

Merge pull request #9288 from ghalliday/issue16533

HPCC-16533 Include time waiting for failed reads in stats

Reviewed-By: Mark Kelly <mark.kelly@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 years ago
parent
commit
c54af62271
1 changed files with 12 additions and 1 deletions
  1. 12 1
      common/remote/sockfile.cpp

+ 12 - 1
common/remote/sockfile.cpp

@@ -2301,7 +2301,16 @@ public:
         size32_t got;
         MemoryBuffer replyBuffer;
         CCycleTimer timer;
-        const void *b = doRead(pos,len,replyBuffer,got,data);
+        const void *b;
+        try
+        {
+            b = doRead(pos,len,replyBuffer,got,data);
+        }
+        catch (...)
+        {
+            ioReadCycles.fetch_add(timer.elapsedCycles());
+            throw;
+        }
         ioReadCycles.fetch_add(timer.elapsedCycles());
         ioReadBytes.fetch_add(got);
         ++ioReads;
@@ -2396,6 +2405,7 @@ public:
                 if (++tries > 3)
                 {
                     ioRetries.fetch_add(tries);
+                    ioWriteCycles.fetch_add(timer.elapsedCycles());
                     throw;
                 }
                 WARNLOG("Retrying write(%" I64F "d,%d) of %s (%d)",pos,len,parent->queryLocalName(),tries);
@@ -2403,6 +2413,7 @@ public:
                 if (!reopen())
                 {
                     ioRetries.fetch_add(tries);
+                    ioWriteCycles.fetch_add(timer.elapsedCycles());
                     throw exc.getClear();
                 }
             }