COMPMID-417 Minor documentation fixes and error handling in instruments

Fixed some Doxygen issues in the introduction and tests sections
Switched MaliCounter to use ARM_COMPUTE_ERROR in order to get more context in case of failure
Switched to use ARM_COMPUTE_ERROR instead of ERROR_ON in PMU and MaliCounter so that checks work in release mode too. (As these checks are to detect platform issues rather than programming errors)

Change-Id: Ibbefa5a87d93c5c3aa5e190680052e4e99987dfe
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/89662
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
diff --git a/tests/framework/instruments/MaliCounter.cpp b/tests/framework/instruments/MaliCounter.cpp
index 887846e..6cc3ac5 100644
--- a/tests/framework/instruments/MaliCounter.cpp
+++ b/tests/framework/instruments/MaliCounter.cpp
@@ -23,6 +23,8 @@
  */
 #include "MaliCounter.h"
 
+#include "arm_compute/core/Error.h"
+
 namespace arm_compute
 {
 namespace test
@@ -46,7 +48,7 @@
 
     if(fd < 0)
     {
-        throw std::runtime_error("Failed to get HW info.");
+        ARM_COMPUTE_ERROR("Failed to get HW info.");
     }
 
     {
@@ -57,7 +59,7 @@
 
         if(mali_userspace::mali_ioctl(fd, version_check_args) != 0)
         {
-            throw std::runtime_error("Failed to check version.");
+            ARM_COMPUTE_ERROR("Failed to check version.");
             close(fd);
         }
     }
@@ -70,7 +72,7 @@
 
         if(mali_userspace::mali_ioctl(fd, flags) != 0)
         {
-            throw std::runtime_error("Failed settings flags ioctl.");
+            ARM_COMPUTE_ERROR("Failed settings flags ioctl.");
             close(fd);
         }
     }
@@ -81,7 +83,7 @@
 
         if(mali_ioctl(fd, props) != 0)
         {
-            throw std::runtime_error("Failed settings flags ioctl.");
+            ARM_COMPUTE_ERROR("Failed settings flags ioctl.");
             close(fd);
         }
 
@@ -141,7 +143,7 @@
 
     if(_fd < 0)
     {
-        throw std::runtime_error("Failed to open /dev/mali0.");
+        ARM_COMPUTE_ERROR("Failed to open /dev/mali0.");
     }
 
     {
@@ -150,11 +152,11 @@
 
         if(mali_userspace::mali_ioctl(_fd, check) != 0)
         {
-            throw std::runtime_error("Failed to get ABI version.");
+            ARM_COMPUTE_ERROR("Failed to get ABI version.");
         }
         else if(check.major < 10)
         {
-            throw std::runtime_error("Unsupported ABI version 10.");
+            ARM_COMPUTE_ERROR("Unsupported ABI version 10.");
         }
     }
 
@@ -166,7 +168,7 @@
 
         if(mali_userspace::mali_ioctl(_fd, flags) != 0)
         {
-            throw std::runtime_error("Failed settings flags ioctl.");
+            ARM_COMPUTE_ERROR("Failed settings flags ioctl.");
         }
     }
 
@@ -183,7 +185,7 @@
 
         if(mali_userspace::mali_ioctl(_fd, setup) != 0)
         {
-            throw std::runtime_error("Failed setting hwcnt reader ioctl.");
+            ARM_COMPUTE_ERROR("Failed setting hwcnt reader ioctl.");
         }
 
         _hwc_fd = setup.fd;
@@ -194,34 +196,34 @@
 
         if(ioctl(_hwc_fd, mali_userspace::KBASE_HWCNT_READER_GET_API_VERSION, &api_version) != 0) // NOLINT
         {
-            throw std::runtime_error("Could not determine hwcnt reader API.");
+            ARM_COMPUTE_ERROR("Could not determine hwcnt reader API.");
         }
         else if(api_version != mali_userspace::HWCNT_READER_API)
         {
-            throw std::runtime_error("Invalid API version.");
+            ARM_COMPUTE_ERROR("Invalid API version.");
         }
     }
 
     if(ioctl(_hwc_fd, static_cast<int>(mali_userspace::KBASE_HWCNT_READER_GET_BUFFER_SIZE), &_buffer_size) != 0) // NOLINT
     {
-        throw std::runtime_error("Failed to get buffer size.");
+        ARM_COMPUTE_ERROR("Failed to get buffer size.");
     }
 
     if(ioctl(_hwc_fd, static_cast<int>(mali_userspace::KBASE_HWCNT_READER_GET_HWVER), &_hw_ver) != 0) // NOLINT
     {
-        throw std::runtime_error("Could not determine HW version.");
+        ARM_COMPUTE_ERROR("Could not determine HW version.");
     }
 
     if(_hw_ver < 5)
     {
-        throw std::runtime_error("Unsupported HW version.");
+        ARM_COMPUTE_ERROR("Unsupported HW version.");
     }
 
     _sample_data = static_cast<uint8_t *>(mmap(nullptr, _buffer_count * _buffer_size, PROT_READ, MAP_PRIVATE, _hwc_fd, 0));
 
     if(_sample_data == MAP_FAILED) // NOLINT
     {
-        throw std::runtime_error("Failed to map sample data.");
+        ARM_COMPUTE_ERROR("Failed to map sample data.");
     }
 
     auto product = std::find_if(std::begin(mali_userspace::products), std::end(mali_userspace::products), [&](const mali_userspace::CounterMapping & cm)
@@ -235,7 +237,7 @@
     }
     else
     {
-        throw std::runtime_error("Could not identify GPU.");
+        ARM_COMPUTE_ERROR("Could not identify GPU.");
     }
 
     _raw_counter_buffer.resize(_buffer_size / sizeof(uint32_t));
@@ -279,7 +281,7 @@
 {
     if(ioctl(_hwc_fd, mali_userspace::KBASE_HWCNT_READER_DUMP, 0) != 0)
     {
-        throw std::runtime_error("Could not sample hardware counters.");
+        ARM_COMPUTE_ERROR("Could not sample hardware counters.");
     }
 }
 
@@ -293,7 +295,7 @@
 
     if(count < 0)
     {
-        throw std::runtime_error("poll() failed.");
+        ARM_COMPUTE_ERROR("poll() failed.");
     }
 
     if((poll_fd.revents & POLLIN) != 0)
@@ -302,7 +304,7 @@
 
         if(ioctl(_hwc_fd, static_cast<int>(mali_userspace::KBASE_HWCNT_READER_GET_BUFFER), &meta) != 0) // NOLINT
         {
-            throw std::runtime_error("Failed READER_GET_BUFFER.");
+            ARM_COMPUTE_ERROR("Failed READER_GET_BUFFER.");
         }
 
         memcpy(_raw_counter_buffer.data(), _sample_data + _buffer_size * meta.buffer_idx, _buffer_size);
@@ -310,12 +312,12 @@
 
         if(ioctl(_hwc_fd, mali_userspace::KBASE_HWCNT_READER_PUT_BUFFER, &meta) != 0) // NOLINT
         {
-            throw std::runtime_error("Failed READER_PUT_BUFFER.");
+            ARM_COMPUTE_ERROR("Failed READER_PUT_BUFFER.");
         }
     }
     else if((poll_fd.revents & POLLHUP) != 0)
     {
-        throw std::runtime_error("HWC hung up.");
+        ARM_COMPUTE_ERROR("HWC hung up.");
     }
 }
 
@@ -337,7 +339,7 @@
         default:
             if(core < 0)
             {
-                std::runtime_error("Invalid core number.");
+                ARM_COMPUTE_ERROR("Invalid core number.");
             }
 
             return _raw_counter_buffer.data() + mali_userspace::MALI_NAME_BLOCK_SIZE * (3 + _core_index_remap[core]);