mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 12:27:29 +09:00
parent
9195e9e4e3
commit
b586913598
53 changed files with 60 additions and 750 deletions
|
|
@ -44,7 +44,7 @@
|
|||
#include "mozilla/ProfileGatherer.h"
|
||||
#endif
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
#include "FennecJNIWrappers.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ GeckoSampler::GeckoSampler(double aInterval, int aEntrySize,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
mProfileJava = mozilla::jni::IsFennec() &&
|
||||
hasFeature(aFeatures, aFeatureCount, "java");
|
||||
#else
|
||||
|
|
@ -462,7 +462,7 @@ void SubProcessCallback(const char* aProfile, void* aClosure)
|
|||
}
|
||||
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
static
|
||||
void BuildJavaThreadJSObject(SpliceableJSONWriter& aWriter)
|
||||
{
|
||||
|
|
@ -567,7 +567,7 @@ void GeckoSampler::StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
if (ProfileJava()) {
|
||||
java::GeckoJavaSampler::Pause();
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@
|
|||
#include "GeckoTaskTracer.h"
|
||||
#endif
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
#include "FennecJNIWrappers.h"
|
||||
#endif
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
#include "FennecJNINatives.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
class GeckoJavaSampler : public java::GeckoJavaSampler::Natives<GeckoJavaSampler>
|
||||
{
|
||||
private:
|
||||
|
|
@ -502,7 +502,7 @@ void mozilla_sampler_init(void* stackTop)
|
|||
set_stderr_callback(mozilla_sampler_log);
|
||||
#endif
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
if (mozilla::jni::IsFennec()) {
|
||||
GeckoJavaSampler::Init();
|
||||
}
|
||||
|
|
@ -524,7 +524,7 @@ void mozilla_sampler_init(void* stackTop)
|
|||
|| defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_x86_linux)
|
||||
, "stackwalk"
|
||||
#endif
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
, "java"
|
||||
#endif
|
||||
};
|
||||
|
|
@ -819,7 +819,7 @@ void mozilla_sampler_start(int aProfileEntries, double aInterval,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
if (t->ProfileJava()) {
|
||||
int javaInterval = aInterval;
|
||||
// Java sampling doesn't accuratly keep up with 1ms sampling
|
||||
|
|
@ -1021,15 +1021,6 @@ bool mozilla_sampler_register_thread(const char* aName, void* aGuessStackTop)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK) && !defined(MOZ_PROFILING)
|
||||
// The only way to profile secondary threads on b2g
|
||||
// is to build with profiling OR have the profiler
|
||||
// running on startup.
|
||||
if (!profiler_is_active()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(tlsPseudoStack.get() == nullptr);
|
||||
PseudoStack* stack = PseudoStack::create();
|
||||
tlsPseudoStack.set(stack);
|
||||
|
|
|
|||
|
|
@ -393,10 +393,7 @@ class Sampler {
|
|||
static mozilla::UniquePtr<Mutex> sRegisteredThreadsMutex;
|
||||
|
||||
static bool CanNotifyObservers() {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// We use profile.sh on b2g to manually select threads and options per process.
|
||||
return false;
|
||||
#elif defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
// Android ANR reporter uses the profiler off the main thread
|
||||
return NS_IsMainThread();
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ static std::string getId(const char *bin_name)
|
|||
return "";
|
||||
}
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
// TODO fix me with proper include
|
||||
#include "nsDebug.h"
|
||||
#ifdef ANDROID
|
||||
|
|
@ -86,13 +85,10 @@ dl_iterate_callback(struct dl_phdr_info *dl_info, size_t size, void *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif // !MOZ_WIDGET_GONK
|
||||
|
||||
SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||
{
|
||||
SharedLibraryInfo info;
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
#ifdef ANDROID
|
||||
if (!dl_iterate_phdr) {
|
||||
// On ARM Android, dl_iterate_phdr is provided by the custom linker.
|
||||
|
|
@ -104,9 +100,8 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
|||
#endif // ANDROID
|
||||
|
||||
dl_iterate_phdr(dl_iterate_callback, &info);
|
||||
#endif // !MOZ_WIDGET_GONK
|
||||
|
||||
#if defined(ANDROID) || defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID)
|
||||
pid_t pid = getpid();
|
||||
char path[PATH_MAX];
|
||||
snprintf(path, PATH_MAX, "/proc/%d/maps", pid);
|
||||
|
|
@ -132,19 +127,10 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
|||
LOG("Get maps line failed");
|
||||
continue;
|
||||
}
|
||||
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
|
||||
// Use proc/pid/maps to get the dalvik-jit section since it has
|
||||
// no associated phdrs
|
||||
if (strcmp(name, "/dev/ashmem/dalvik-jit-code-cache") != 0)
|
||||
continue;
|
||||
#else
|
||||
if (strcmp(perm, "r-xp") != 0) {
|
||||
// Ignore entries that are writable and/or shared.
|
||||
// At least one graphics driver uses short-lived "rwxs" mappings
|
||||
// (see bug 926734 comment 5), so just checking for 'x' isn't enough.
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
SharedLibrary shlib(start, end, offset, getId(name), name);
|
||||
info.AddSharedLibrary(shlib);
|
||||
if (count > 10000) {
|
||||
|
|
@ -153,7 +139,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
|||
}
|
||||
count++;
|
||||
}
|
||||
#endif // ANDROID || MOZ_WIDGET_GONK
|
||||
#endif // ANDROID
|
||||
|
||||
return info;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
nsresult
|
||||
SaveProfileTask::Run() {
|
||||
// Get file path
|
||||
#if defined(SPS_PLAT_arm_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_PLAT_arm_android)
|
||||
nsCString tmpPath;
|
||||
tmpPath.AppendPrintf("/sdcard/profile_%i_%i.txt", XRE_GetProcessType(), getpid());
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "PlatformMacros.h"
|
||||
#include "AutoObjectMapper.h"
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
# include <dlfcn.h>
|
||||
# include "mozilla/Types.h"
|
||||
// FIXME move these out of mozglue/linker/ElfLoader.h into their
|
||||
|
|
@ -108,7 +108,7 @@ bool AutoObjectMapperPOSIX::Map(/*OUT*/void** start, /*OUT*/size_t* length,
|
|||
}
|
||||
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
// A helper function for AutoObjectMapperFaultyLib::Map. Finds out
|
||||
// where the installation's lib directory is, since we'll have to look
|
||||
// in there to get hold of libmozglue.so. Returned C string is heap
|
||||
|
|
@ -204,4 +204,4 @@ bool AutoObjectMapperFaultyLib::Map(/*OUT*/void** start, /*OUT*/size_t* length,
|
|||
}
|
||||
}
|
||||
|
||||
#endif // defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#endif // defined(SPS_OS_android)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(SPS_OS_android)
|
||||
// This is a variant of AutoObjectMapperPOSIX suitable for use in
|
||||
// conjunction with faulty.lib on Android. How it behaves depends on
|
||||
// the name of the file to be mapped. There are three possible cases:
|
||||
|
|
@ -110,6 +110,6 @@ private:
|
|||
void operator delete[](void*);
|
||||
};
|
||||
|
||||
#endif // defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
#endif // defined(SPS_OS_android)
|
||||
|
||||
#endif // AutoObjectMapper_h
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ read_procmaps(lul::LUL* aLUL)
|
|||
for (size_t i = 0; i < info.GetSize(); i++) {
|
||||
const SharedLibrary& lib = info.GetEntry(i);
|
||||
|
||||
# if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
# if defined(SPS_OS_android)
|
||||
// We're using faulty.lib. Use a special-case object mapper.
|
||||
AutoObjectMapperFaultyLib mapper(aLUL->mLog);
|
||||
# else
|
||||
|
|
|
|||
|
|
@ -346,13 +346,6 @@ static inline void profiler_tracing(const char* aCategory, const char* aInfo,
|
|||
#define PROFILER_MAIN_THREAD_LABEL_PRINTF(name_space, info, category, ...) MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla::SamplerStackFramePrintfRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, category, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
||||
/* FIXME/bug 789667: memory constraints wouldn't much of a problem for
|
||||
* this small a sample buffer size, except that serializing the
|
||||
* profile data is extremely, unnecessarily memory intensive. */
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
# define PLATFORM_LIKELY_MEMORY_CONSTRAINED
|
||||
#endif
|
||||
|
||||
#if !defined(PLATFORM_LIKELY_MEMORY_CONSTRAINED) && !defined(ARCH_ARMV6)
|
||||
# define PROFILE_DEFAULT_ENTRY 1000000
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue