From aff19e13c7d78ea888c7fe19b8163c4b8a2f3790 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 19 May 2020 11:37:44 +1000 Subject: [PATCH] [profiler] client: updated to use new lgmp API and path --- VERSION | 2 +- profile/client/CMakeLists.txt | 4 ++-- profile/client/src/main.c | 26 +++++++++++++++++--------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/VERSION b/VERSION index c7000b8b..07699dd2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-195-g06f8911ee1+1 \ No newline at end of file +B1-196-g007122df43+1 \ No newline at end of file diff --git a/profile/client/CMakeLists.txt b/profile/client/CMakeLists.txt index bb613108..dad2553c 100644 --- a/profile/client/CMakeLists.txt +++ b/profile/client/CMakeLists.txt @@ -52,8 +52,8 @@ set(SOURCES src/main.c ) -add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common") -add_subdirectory("${PROJECT_TOP}/LGMP/lgmp" "${CMAKE_BINARY_DIR}/lgmp" ) +add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common") +add_subdirectory("${PROJECT_TOP}/repos/LGMP/lgmp" "${CMAKE_BINARY_DIR}/lgmp" ) add_executable(profiler-client ${SOURCES}) target_compile_options(profiler-client PUBLIC ${PKGCONFIG_CFLAGS_OTHER}) diff --git a/profile/client/src/main.c b/profile/client/src/main.c index 0d4d0577..dd9a98aa 100644 --- a/profile/client/src/main.c +++ b/profile/client/src/main.c @@ -104,25 +104,33 @@ static bool config_load(int argc, char * argv[]) return true; } -static inline uint64_t nanotime() -{ - struct timespec time; - clock_gettime(CLOCK_MONOTONIC_RAW, &time); - return ((uint64_t)time.tv_sec * 1e9) + time.tv_nsec; -} - static int run() { PLGMPClient lgmp; PLGMPClientQueue frameQueue; + uint32_t udataSize; + KVMFR *udata; + LGMP_STATUS status; - if ((status = lgmpClientInit(state.shmDev.mem, state.shmDev.size, &lgmp)) != LGMP_OK) + if ((status = lgmpClientInit(state.shmDev.mem, state.shmDev.size, &lgmp, + &udataSize, (uint8_t **)&udata)) != LGMP_OK) { DEBUG_ERROR("lgmpClientInit: %s", lgmpStatusString(status)); return -1; } + if (udataSize != sizeof(KVMFR) || + memcmp(udata->magic, KVMFR_MAGIC, sizeof(udata->magic)) != 0 || + udata->version != KVMFR_VERSION) + { + DEBUG_BREAK(); + DEBUG_ERROR("The host application is not compatible with this client"); + DEBUG_ERROR("Expected KVMFR version %d", KVMFR_VERSION); + DEBUG_BREAK(); + return -1; + } + if ((status = lgmpClientSubscribe(lgmp, LGMP_Q_FRAME, &frameQueue) != LGMP_OK)) { DEBUG_ERROR("lgmpClientSubscribe: %s", lgmpStatusString(status)); @@ -227,4 +235,4 @@ int main(int argc, char * argv[]) ivshmemClose(&state.shmDev); option_free(); return ret; -} \ No newline at end of file +}