From 8f280b147bc51a38a569e686e72cf703ba167e9f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 30 Oct 2017 14:59:05 +0100 Subject: [PATCH] Getting program name on android. --- client/TracyProfiler.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 00cf5b19..9b4dca5a 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "../common/TracyProtocol.hpp" @@ -60,11 +61,15 @@ static const char* GetProcessName() while( ptr > buf && *ptr != '\\' && *ptr != '/' ) ptr--; if( ptr > buf ) ptr++; return ptr; +#elif defined __ANDROID__ +# if __ANDROID_API__ >= 21 + auto buf = getprogname(); + if( buf ) return buf; +# endif #elif defined _GNU_SOURCE return program_invocation_short_name; -#else - return "unknown"; #endif + return "unknown"; } enum { QueuePrealloc = 256 * 1024 };