Bug 1221846 - Get Task Tracer building on desktop r=cyu.
This commit is contained in:
@@ -7386,7 +7386,7 @@ MOZ_ARG_ENABLE_BOOL(tasktracer,
|
|||||||
[ --enable-tasktracer Set compile flags necessary for using TaskTracer],
|
[ --enable-tasktracer Set compile flags necessary for using TaskTracer],
|
||||||
MOZ_TASK_TRACER=1,
|
MOZ_TASK_TRACER=1,
|
||||||
MOZ_TASK_TRACER= )
|
MOZ_TASK_TRACER= )
|
||||||
if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
|
if test -n "$MOZ_TASK_TRACER"; then
|
||||||
AC_DEFINE(MOZ_TASK_TRACER)
|
AC_DEFINE(MOZ_TASK_TRACER)
|
||||||
AC_SUBST(MOZ_TASK_TRACER)
|
AC_SUBST(MOZ_TASK_TRACER)
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ if CONFIG['ENABLE_TESTS']:
|
|||||||
'/testing/web-platform',
|
'/testing/web-platform',
|
||||||
]
|
]
|
||||||
|
|
||||||
if CONFIG['MOZ_WEBRTC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
|
if CONFIG['MOZ_WEBRTC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and not CONFIG['MOZ_TASK_TRACER']:
|
||||||
DIRS += [
|
DIRS += [
|
||||||
'/media/webrtc/signaling/test',
|
'/media/webrtc/signaling/test',
|
||||||
'/media/webrtc/signaling/test/standalone',
|
'/media/webrtc/signaling/test/standalone',
|
||||||
|
|||||||
@@ -121,9 +121,9 @@ EXPORTS += [
|
|||||||
|
|
||||||
if CONFIG['MOZ_TASK_TRACER']:
|
if CONFIG['MOZ_TASK_TRACER']:
|
||||||
EXPORTS += [
|
EXPORTS += [
|
||||||
'public/GeckoTaskTracer.h',
|
'tasktracer/GeckoTaskTracer.h',
|
||||||
'public/GeckoTaskTracerImpl.h',
|
'tasktracer/GeckoTaskTracerImpl.h',
|
||||||
'public/TracedTaskCommon.h',
|
'tasktracer/TracedTaskCommon.h',
|
||||||
]
|
]
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'tasktracer/GeckoTaskTracer.cpp',
|
'tasktracer/GeckoTaskTracer.cpp',
|
||||||
|
|||||||
@@ -19,13 +19,25 @@
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
// We need a definition of gettid(), but glibc doesn't provide a
|
||||||
|
// wrapper for it.
|
||||||
#if defined(__GLIBC__)
|
#if defined(__GLIBC__)
|
||||||
// glibc doesn't implement gettid(2).
|
#include <unistd.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
static pid_t gettid()
|
static inline pid_t gettid()
|
||||||
{
|
{
|
||||||
return (pid_t) syscall(SYS_gettid);
|
return (pid_t) syscall(SYS_gettid);
|
||||||
}
|
}
|
||||||
|
#elif defined(XP_MACOSX)
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
static inline pid_t gettid()
|
||||||
|
{
|
||||||
|
return (pid_t) syscall(SYS_thread_selfid);
|
||||||
|
}
|
||||||
|
#elif defined(LINUX)
|
||||||
|
#include <sys/types.h>
|
||||||
|
pid_t gettid();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NS_ENSURE_TRUE_VOID() without the warning on the debug build.
|
// NS_ENSURE_TRUE_VOID() without the warning on the debug build.
|
||||||
@@ -114,12 +126,12 @@ CreateSourceEvent(SourceEventType aType)
|
|||||||
info->mCurTraceSourceType = aType;
|
info->mCurTraceSourceType = aType;
|
||||||
info->mCurTaskId = newId;
|
info->mCurTaskId = newId;
|
||||||
|
|
||||||
int* namePtr;
|
uintptr_t* namePtr;
|
||||||
#define SOURCE_EVENT_NAME(type) \
|
#define SOURCE_EVENT_NAME(type) \
|
||||||
case SourceEventType::type: \
|
case SourceEventType::type: \
|
||||||
{ \
|
{ \
|
||||||
static int CreateSourceEvent##type; \
|
static int CreateSourceEvent##type; \
|
||||||
namePtr = &CreateSourceEvent##type; \
|
namePtr = (uintptr_t*)&CreateSourceEvent##type; \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,7 +380,7 @@ LogEnd(uint64_t aTaskId, uint64_t aSourceEventId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LogVirtualTablePtr(uint64_t aTaskId, uint64_t aSourceEventId, int* aVptr)
|
LogVirtualTablePtr(uint64_t aTaskId, uint64_t aSourceEventId, uintptr_t* aVptr)
|
||||||
{
|
{
|
||||||
TraceInfo* info = GetOrCreateTraceInfo();
|
TraceInfo* info = GetOrCreateTraceInfo();
|
||||||
ENSURE_TRUE_VOID(info);
|
ENSURE_TRUE_VOID(info);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void LogBegin(uint64_t aTaskId, uint64_t aSourceEventId);
|
|||||||
|
|
||||||
void LogEnd(uint64_t aTaskId, uint64_t aSourceEventId);
|
void LogEnd(uint64_t aTaskId, uint64_t aSourceEventId);
|
||||||
|
|
||||||
void LogVirtualTablePtr(uint64_t aTaskId, uint64_t aSourceEventId, int* aVptr);
|
void LogVirtualTablePtr(uint64_t aTaskId, uint64_t aSourceEventId, uintptr_t* aVptr);
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
} // namespace tasktracer
|
} // namespace tasktracer
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ TracedRunnable::TracedRunnable(already_AddRefed<nsIRunnable>&& aOriginalObj)
|
|||||||
, mOriginalObj(Move(aOriginalObj))
|
, mOriginalObj(Move(aOriginalObj))
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
LogVirtualTablePtr(mTaskId, mSourceEventId, *(int**)(aOriginalObj));
|
LogVirtualTablePtr(mTaskId, mSourceEventId, reinterpret_cast<uintptr_t*>(mOriginalObj.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TracedRunnable::~TracedRunnable()
|
TracedRunnable::~TracedRunnable()
|
||||||
@@ -122,7 +122,7 @@ TracedTask::TracedTask(Task* aOriginalObj)
|
|||||||
, mOriginalObj(aOriginalObj)
|
, mOriginalObj(aOriginalObj)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
LogVirtualTablePtr(mTaskId, mSourceEventId, *(int**)(aOriginalObj));
|
LogVirtualTablePtr(mTaskId, mSourceEventId, reinterpret_cast<uintptr_t*>(aOriginalObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
TracedTask::~TracedTask()
|
TracedTask::~TracedTask()
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
#ifdef MOZ_TASK_TRACER
|
||||||
|
#include "GeckoTaskTracerImpl.h"
|
||||||
|
using namespace mozilla::tasktracer;
|
||||||
|
#endif
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(TimerThread, nsIRunnable, nsIObserver)
|
NS_IMPL_ISUPPORTS(TimerThread, nsIRunnable, nsIObserver)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user