summaryrefslogtreecommitdiffstats
path: root/tools/profiler/core
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
commit086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch)
treea4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /tools/profiler/core
parentAdding debian version 124.0.1-1. (diff)
downloadfirefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz
firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/profiler/core')
-rw-r--r--tools/profiler/core/ETWTools.cpp21
-rw-r--r--tools/profiler/core/ProfileBuffer.cpp5
-rw-r--r--tools/profiler/core/ProfileBuffer.h3
-rw-r--r--tools/profiler/core/platform-macos.cpp14
-rw-r--r--tools/profiler/core/platform.cpp12
5 files changed, 34 insertions, 21 deletions
diff --git a/tools/profiler/core/ETWTools.cpp b/tools/profiler/core/ETWTools.cpp
index b8fab9b316..50b5588392 100644
--- a/tools/profiler/core/ETWTools.cpp
+++ b/tools/profiler/core/ETWTools.cpp
@@ -11,13 +11,24 @@
namespace ETW {
std::atomic<ULONGLONG> gETWCollectionMask = 0;
-// Define a handle to a TraceLogging provider
+// Define a handle to a TraceLogging provider.
+//
+// > All ETW providers are identified by both provider name and provider ID.
+// > [...]
+// > Microsoft recommends generating the provider ID from the provider name
+// > using the ETW name-hashing algorithm described below. This provides
+// > several benefits: it's easier to remember just the name; the ID and the
+// > name are automatically linked; tools such as tracelog, traceview,
+// > EventSource, and WPR have special support for providers that use IDs
+// > generated using this algorithm.
+//
+// https://learn.microsoft.com/en-us/windows/win32/api/traceloggingprovider/nf-traceloggingprovider-tracelogging_define_provider
+//
+// The GUID generated for "Mozilla.FirefoxTraceLogger" is:
+// {c923f508-96e4-5515-e32c-7539d1b10504}
TRACELOGGING_DEFINE_PROVIDER(kFirefoxTraceLoggingProvider,
"Mozilla.FirefoxTraceLogger",
- // This GUID is a hash generated based on the
- // above string.
- // {c923f508-96e4-5515-e32c-7539d1b10504}
- (0xc923f508, 0x96e4, 0x5515, 0xe3, 0x3c, 0x75,
+ (0xc923f508, 0x96e4, 0x5515, 0xe3, 0x2c, 0x75,
0x39, 0xd1, 0xb1, 0x05, 0x04));
static void NTAPI ETWEnableCallback(LPCGUID aSourceId, ULONG aIsEnabled,
diff --git a/tools/profiler/core/ProfileBuffer.cpp b/tools/profiler/core/ProfileBuffer.cpp
index bc6314fa32..d785cf7956 100644
--- a/tools/profiler/core/ProfileBuffer.cpp
+++ b/tools/profiler/core/ProfileBuffer.cpp
@@ -193,9 +193,10 @@ void ProfileBufferCollector::CollectJitReturnAddr(void* aAddr) {
mBuf.AddEntry(ProfileBufferEntry::JitReturnAddr(aAddr));
}
-void ProfileBufferCollector::CollectWasmFrame(const char* aLabel) {
+void ProfileBufferCollector::CollectWasmFrame(
+ JS::ProfilingCategoryPair aCategory, const char* aLabel) {
mBuf.CollectCodeLocation("", aLabel, 0, 0, Nothing(), Nothing(),
- Some(JS::ProfilingCategoryPair::JS_Wasm));
+ Some(aCategory));
}
void ProfileBufferCollector::CollectProfilingStackFrame(
diff --git a/tools/profiler/core/ProfileBuffer.h b/tools/profiler/core/ProfileBuffer.h
index 5da34909cc..383c7b16d6 100644
--- a/tools/profiler/core/ProfileBuffer.h
+++ b/tools/profiler/core/ProfileBuffer.h
@@ -247,7 +247,8 @@ class ProfileBufferCollector final : public ProfilerStackCollector {
virtual void CollectNativeLeafAddr(void* aAddr) override;
virtual void CollectJitReturnAddr(void* aAddr) override;
- virtual void CollectWasmFrame(const char* aLabel) override;
+ virtual void CollectWasmFrame(JS::ProfilingCategoryPair aCategory,
+ const char* aLabel) override;
virtual void CollectProfilingStackFrame(
const js::ProfilingStackFrame& aFrame) override;
diff --git a/tools/profiler/core/platform-macos.cpp b/tools/profiler/core/platform-macos.cpp
index 356d9f803e..78f000c470 100644
--- a/tools/profiler/core/platform-macos.cpp
+++ b/tools/profiler/core/platform-macos.cpp
@@ -15,7 +15,6 @@
#include <semaphore.h>
#include <signal.h>
#include <libkern/OSAtomic.h>
-#include <libproc.h>
#include <mach/mach.h>
#include <mach/semaphore.h>
#include <mach/task.h>
@@ -83,13 +82,12 @@ static RunningTimes GetProcessRunningTimesDiff(
{
AUTO_PROFILER_STATS(GetProcessRunningTimes_task_info);
- static const auto pid = getpid();
- struct proc_taskinfo pti;
- if ((unsigned long)proc_pidinfo(pid, PROC_PIDTASKINFO, 0, &pti,
- PROC_PIDTASKINFO_SIZE) >=
- PROC_PIDTASKINFO_SIZE) {
- newRunningTimes.SetThreadCPUDelta(pti.pti_total_user +
- pti.pti_total_system);
+ task_power_info_data_t task_power_info;
+ mach_msg_type_number_t count = TASK_POWER_INFO_COUNT;
+ if (task_info(mach_task_self(), TASK_POWER_INFO,
+ (task_info_t)&task_power_info, &count) == KERN_SUCCESS) {
+ newRunningTimes.SetThreadCPUDelta(task_power_info.total_user +
+ task_power_info.total_system);
}
newRunningTimes.SetPostMeasurementTimeStamp(TimeStamp::Now());
};
diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp
index e4af84ed4c..8ce029402b 100644
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -114,7 +114,7 @@
# include "mozilla/jni/Refs.h"
#endif
-#if defined(GP_OS_darwin)
+#if defined(XP_MACOSX)
# include "nsCocoaFeatures.h"
#endif
@@ -275,7 +275,7 @@ class GeckoJavaSampler
featureStringArray.length());
// 128 * 1024 * 1024 is the entries preset that is given in
- // devtools/client/performance-new/shared/background.jsm.js
+ // devtools/client/performance-new/shared/background.sys.mjs
profiler_start(PowerOfTwo32(128 * 1024 * 1024), 5.0, features,
filtersTemp.begin(), filtersTemp.length(), 0, Nothing());
}
@@ -2055,8 +2055,10 @@ static void MergeStacks(
// the buffer, nsRefreshDriver would now be holding on to a backtrace
// with stale JIT code return addresses.
if (aIsSynchronous ||
- jsFrame.kind == JS::ProfilingFrameIterator::Frame_Wasm) {
- aCollector.CollectWasmFrame(jsFrame.label);
+ jsFrame.kind == JS::ProfilingFrameIterator::Frame_WasmIon ||
+ jsFrame.kind == JS::ProfilingFrameIterator::Frame_WasmBaseline ||
+ jsFrame.kind == JS::ProfilingFrameIterator::Frame_WasmOther) {
+ aCollector.CollectWasmFrame(jsFrame.profilingCategory(), jsFrame.label);
} else if (jsFrame.kind ==
JS::ProfilingFrameIterator::Frame_BaselineInterpreter) {
// Materialize a ProfilingStackFrame similar to the C++ Interpreter. We
@@ -2803,7 +2805,7 @@ static PreRecordedMetaInformation PreRecordMetaInformation(
!NS_FAILED(res) && http) {
Unused << http->GetPlatform(info.mHttpPlatform);
-#if defined(GP_OS_darwin)
+#if defined(XP_MACOSX)
// On Mac, the http "oscpu" is capped at 10.15, so we need to get the real
// OS version directly.
int major = 0;