Bug 705856 - Enable SPS profiler on desktop Linux. r=BenWa

--HG--
extra : rebase_source : 0662b092e648c37e3c9f1ca2159381483338e946
This commit is contained in:
Justin Lebar 2011-12-12 15:44:41 -05:00
parent 251efb48b8
commit ab9d543914
4 changed files with 16 additions and 4 deletions

View File

@ -78,7 +78,7 @@ EXTRA_JS_MODULES = \
Profiler.jsm \
$(NULL)
ifeq ($(OS_TARGET),Android)
ifneq (,$(filter Android Linux,$(OS_TARGET)))
DEFINES += -DMOZ_ENABLE_PROFILER_SPS

View File

@ -86,7 +86,7 @@
#endif
// Redefine the macros for platforms where SPS is supported.
#if defined(ANDROID) || defined(XP_MACOSX) || defined(XP_WIN)
#if defined(ANDROID) || defined(XP_LINUX) || defined(XP_MACOSX) || defined(XP_WIN)
#include "sps_sampler.h"
@ -106,6 +106,7 @@
#define SAMPLER_GET_RESPONSIVENESS() NULL
#define SAMPLE_LABEL(name_space, info)
#define SAMPLE_MARKER(info)
#endif
#endif
#endif // ifndef SAMPLER_H

View File

@ -47,6 +47,15 @@
#define PATH_MAX_TOSTRING(x) #x
#define PATH_MAX_STRING(x) PATH_MAX_TOSTRING(x)
#if defined(__GLIBC__)
// glibc doesn't implement gettid(2).
#include <sys/syscall.h>
pid_t gettid()
{
return (pid_t) syscall(SYS_gettid);
}
#endif
#ifdef ENABLE_SPS_LEAF_DATA
/* a crapy version of getline, because it's not included in bionic */
static ssize_t getline(char **lineptr, size_t *n, FILE *stream)
@ -194,7 +203,6 @@ class Sampler::PlatformData : public Malloced {
: sampler_(sampler),
signal_handler_installed_(false),
vm_tgid_(getpid()),
// Glibc doesn't provide a wrapper for gettid(2).
vm_tid_(gettid()),
signal_sender_launched_(false) {
}

View File

@ -37,6 +37,9 @@
* ***** END LICENSE BLOCK ***** */
#include <stdlib.h>
#include <signal.h>
#include <pthread.h>
#include "base/atomicops.h"
#include "thread_helper.h"
#include "nscore.h"
#include "mozilla/TimeStamp.h"