IVGCVSW-3721 Add support for startup sequence (Mock Gatord service).

* Receive and process the stream metadata from the client.
* Send the connection ack packet.
* Wait in a receiving thread and print the packets.
* GatordMockTest and Impl for PeriodicCounterCapture CommandHandler
* CaptureData class to retain packet data
* MockUtils
* Update SocketProfilingConnection to fix non blocking receipt of packets.
* Restructure directory layout following review comments.
* Extract the mock service into a static library in the cmake files.

Signed-off-by: Colm Donelan <Colm.Donelan@arm.com>
Signed-off-by: Keith Davis <keith.davis@arm.com>
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Signed-off-by: Kevin May <kevin.may@arm.com>
Change-Id: I33c1c9f93976708c9315f71290d42cff53b8c075
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e415d0..0430643 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -782,6 +782,12 @@
         set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
     endif()
 
+    if(BUILD_GATORD_MOCK)
+        list(APPEND unittest_sources
+            tests/profiling/gatordmock/tests/GatordMockTests.cpp
+            )
+    endif()
+
     foreach(lib ${armnnUnitTestLibraries})
         message("Adding object library dependency to UnitTests: ${lib}")
         list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
@@ -812,6 +818,10 @@
         target_link_libraries(UnitTests armnnTfParser)
     endif()
 
+    if(BUILD_GATORD_MOCK)
+        target_link_libraries(UnitTests gatordMockService)
+    endif()
+
     if(BUILD_TF_LITE_PARSER)
         target_include_directories(UnitTests SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
         target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
@@ -879,19 +889,30 @@
 if(BUILD_GATORD_MOCK)
     set(gatord_mock_sources)
     list(APPEND gatord_mock_sources
-        tests/profiling/GatordMockMain.cpp
-        tests/profiling/CommandLineProcessor.hpp
-        tests/profiling/CommandLineProcessor.cpp
-        tests/profiling/GatordMockService.hpp
-        tests/profiling/GatordMockService.cpp
+        tests/profiling/gatordmock/CommandFileParser.hpp
+        tests/profiling/gatordmock/CommandFileParser.cpp
+        tests/profiling/gatordmock/CommandLineProcessor.hpp
+        tests/profiling/gatordmock/CommandLineProcessor.cpp
+        tests/profiling/gatordmock/GatordMockService.hpp
+        tests/profiling/gatordmock/GatordMockService.cpp
+        tests/profiling/gatordmock/MockUtils.hpp
+        tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp
+        tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
         )
 
-    include_directories( ${Boost_INCLUDE_DIRS} )
+    include_directories( ${Boost_INCLUDE_DIRS} src/profiling)
 
-    add_executable_ex(GartordMock ${gatord_mock_sources})
+    add_library_ex(gatordMockService STATIC ${gatord_mock_sources})
 
+    add_executable_ex(GartordMock tests/profiling/gatordmock/GatordMockMain.cpp)
+
+    if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
+        target_link_libraries(GartordMock pthread)
+    endif()
+
+    target_link_libraries(GartordMock armnn gatordMockService)
     target_link_libraries(GartordMock
-        ${Boost_PROGRAM_OPTIONS_LIBRARY}
+        ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY}
         )
 
-endif()
+endif()
\ No newline at end of file