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

--HG--
extra : rebase_source : 1b47cb9924451b7a581f440a3df9d9a4fdf4c0ec
This commit is contained in:
Justin Lebar 2011-12-15 15:44:13 -05:00
parent 5ea03a4258
commit abf8bd6c79
4 changed files with 14 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,7 @@
* ***** END LICENSE BLOCK ***** */
#include <stdlib.h>
#include <signal.h>
#include "thread_helper.h"
#include "nscore.h"
#include "mozilla/TimeStamp.h"