From 6571d2ceb42930dab01677ef0e95e732d5076fb8 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 12 May 2018 16:19:33 +0200 Subject: Remove MOZ_WIDGET_GONK [1/2] Tag #288 --- tools/profiler/core/GeckoSampler.cpp | 8 ++++---- tools/profiler/core/platform.cpp | 21 ++++++--------------- tools/profiler/core/platform.h | 5 +---- tools/profiler/core/shared-libraries-linux.cc | 18 ++---------------- tools/profiler/gecko/SaveProfileTask.cpp | 2 +- tools/profiler/lul/AutoObjectMapper.cpp | 6 +++--- tools/profiler/lul/AutoObjectMapper.h | 4 ++-- tools/profiler/lul/platform-linux-lul.cpp | 2 +- tools/profiler/public/GeckoProfilerImpl.h | 7 ------- 9 files changed, 20 insertions(+), 53 deletions(-) (limited to 'tools/profiler') diff --git a/tools/profiler/core/GeckoSampler.cpp b/tools/profiler/core/GeckoSampler.cpp index f4249a7a5..4283542f6 100644 --- a/tools/profiler/core/GeckoSampler.cpp +++ b/tools/profiler/core/GeckoSampler.cpp @@ -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(); diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 0d3cb1648..a8a09d66f 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -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 { 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); diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index 2e736d97c..17c8dd25c 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -393,10 +393,7 @@ class Sampler { static mozilla::UniquePtr 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 diff --git a/tools/profiler/core/shared-libraries-linux.cc b/tools/profiler/core/shared-libraries-linux.cc index 24437fb4e..553039fb7 100644 --- a/tools/profiler/core/shared-libraries-linux.cc +++ b/tools/profiler/core/shared-libraries-linux.cc @@ -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; } diff --git a/tools/profiler/gecko/SaveProfileTask.cpp b/tools/profiler/gecko/SaveProfileTask.cpp index 497385355..dbbbe4836 100644 --- a/tools/profiler/gecko/SaveProfileTask.cpp +++ b/tools/profiler/gecko/SaveProfileTask.cpp @@ -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 diff --git a/tools/profiler/lul/AutoObjectMapper.cpp b/tools/profiler/lul/AutoObjectMapper.cpp index a5dc902fd..1bc5ce62a 100644 --- a/tools/profiler/lul/AutoObjectMapper.cpp +++ b/tools/profiler/lul/AutoObjectMapper.cpp @@ -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 # 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) diff --git a/tools/profiler/lul/AutoObjectMapper.h b/tools/profiler/lul/AutoObjectMapper.h index 1f813d6f2..3f60dc44d 100644 --- a/tools/profiler/lul/AutoObjectMapper.h +++ b/tools/profiler/lul/AutoObjectMapper.h @@ -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 diff --git a/tools/profiler/lul/platform-linux-lul.cpp b/tools/profiler/lul/platform-linux-lul.cpp index 9541534a1..da764f3cf 100644 --- a/tools/profiler/lul/platform-linux-lul.cpp +++ b/tools/profiler/lul/platform-linux-lul.cpp @@ -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 diff --git a/tools/profiler/public/GeckoProfilerImpl.h b/tools/profiler/public/GeckoProfilerImpl.h index a32096b94..7011e5cdb 100644 --- a/tools/profiler/public/GeckoProfilerImpl.h +++ b/tools/profiler/public/GeckoProfilerImpl.h @@ -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 -- cgit v1.2.3