1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Use su on android to set tracing variables.

This commit is contained in:
Bartosz Taudul 2019-08-20 12:18:46 +02:00
parent 1712431dfd
commit bfda30be0b

View File

@ -321,6 +321,7 @@ void SysTraceSendExternalName( uint64_t thread )
# include <fcntl.h> # include <fcntl.h>
# include <inttypes.h> # include <inttypes.h>
# include <stdio.h> # include <stdio.h>
# include <stdlib.h>
# include <string.h> # include <string.h>
# include <unistd.h> # include <unistd.h>
@ -338,6 +339,14 @@ static const char SchedSwitch[] = "events/sched/sched_switch/enable";
static const char SchedWakeup[] = "events/sched/sched_wakeup/enable"; static const char SchedWakeup[] = "events/sched/sched_wakeup/enable";
static const char TracePipe[] = "trace_pipe"; static const char TracePipe[] = "trace_pipe";
#ifdef __ANDROID__
static bool TraceWrite( const char* path, size_t psz, const char* val, size_t vsz )
{
char tmp[256];
sprintf( tmp, "su -c 'echo \"%s\" > %s%s'", val, BasePath, path );
return system( tmp ) == 0;
}
#else
static bool TraceWrite( const char* path, size_t psz, const char* val, size_t vsz ) static bool TraceWrite( const char* path, size_t psz, const char* val, size_t vsz )
{ {
char tmp[256]; char tmp[256];
@ -364,6 +373,7 @@ static bool TraceWrite( const char* path, size_t psz, const char* val, size_t vs
val += cnt; val += cnt;
} }
} }
#endif
bool SysTraceStart() bool SysTraceStart()
{ {