IVGCVSW-3964 Implement the Periodic Counter Selection command handler
* Improved the PeriodicCounterPacket class to handle errors properly
* Improved the PeriodicCounterSelectionCommandHandler to handle
invalid counter UIDs in the selection packet
* Added the Periodic Counter Selection command handler to the
ProfilingService class
* Code refactoring and added comments
* Added WaitForPacketSent method to the SendCounterPacket class
to allow waiting for the packets to be sent (useful in the
unit tests)
* Added unit tests and updated the old ones accordingly
* Fixed threading issues with a number of unit tests
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Change-Id: I271b7b0bfa801d88fe1725b934d24e30cd839ed7
diff --git a/src/profiling/Holder.cpp b/src/profiling/Holder.cpp
index 5916017..750be7e 100644
--- a/src/profiling/Holder.cpp
+++ b/src/profiling/Holder.cpp
@@ -11,10 +11,10 @@
namespace profiling
{
-CaptureData& CaptureData::operator= (const CaptureData& captureData)
+CaptureData& CaptureData::operator=(const CaptureData& other)
{
- m_CapturePeriod = captureData.m_CapturePeriod;
- m_CounterIds = captureData.m_CounterIds;
+ m_CapturePeriod = other.m_CapturePeriod;
+ m_CounterIds = other.m_CounterIds;
return *this;
}
@@ -29,12 +29,12 @@
m_CounterIds = counterIds;
}
-std::uint32_t CaptureData::GetCapturePeriod() const
+uint32_t CaptureData::GetCapturePeriod() const
{
return m_CapturePeriod;
}
-std::vector<uint16_t> CaptureData::GetCounterIds() const
+const std::vector<uint16_t>& CaptureData::GetCounterIds() const
{
return m_CounterIds;
}
@@ -42,12 +42,14 @@
CaptureData Holder::GetCaptureData() const
{
std::lock_guard<std::mutex> lockGuard(m_CaptureThreadMutex);
+
return m_CaptureData;
}
void Holder::SetCaptureData(uint32_t capturePeriod, const std::vector<uint16_t>& counterIds)
{
std::lock_guard<std::mutex> lockGuard(m_CaptureThreadMutex);
+
m_CaptureData.SetCapturePeriod(capturePeriod);
m_CaptureData.SetCounterIds(counterIds);
}