IVGCVSW-3939 Code refactoring and minor fixes

 * Fixed value masking in SendPeriodicCounterCapturePacket and updated
   the pertinent unit tests
 * Code refactoring and cleanup
 * Added extra comments to the ProfilingService stop/reset procedure

Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Change-Id: Ibaf2fede76e06d5b8ce7258a4820a60e5993559f
diff --git a/src/profiling/PeriodicCounterCapture.cpp b/src/profiling/PeriodicCounterCapture.cpp
index 5ba1318..f888bc0 100644
--- a/src/profiling/PeriodicCounterCapture.cpp
+++ b/src/profiling/PeriodicCounterCapture.cpp
@@ -30,9 +30,7 @@
     m_KeepRunning.store(true);
 
     // Start the new capture thread.
-    m_PeriodCaptureThread = std::thread(&PeriodicCounterCapture::Capture,
-                                        this,
-                                        std::ref(m_ReadCounterValues));
+    m_PeriodCaptureThread = std::thread(&PeriodicCounterCapture::Capture, this, std::ref(m_ReadCounterValues));
 }
 
 void PeriodicCounterCapture::Stop()
@@ -47,6 +45,7 @@
         m_PeriodCaptureThread.join();
     }
 
+    // Mark the capture thread as not running
     m_IsRunning = false;
 }
 
@@ -114,7 +113,6 @@
 
     }
     while (m_KeepRunning.load());
-
 }
 
 } // namespace profiling