Path: blob/main/lang/bun/files/patch-src_jsc_bindings_BunCPUProfiler.cpp
49052 views
-- Fix build with older JavaScriptCore: approximate<WTF::WallTime>() -> approximateWallTime().12--- src/jsc/bindings/BunCPUProfiler.cpp.orig 2026-05-14 00:23:23 UTC3+++ src/jsc/bindings/BunCPUProfiler.cpp4@@ -49,7 +49,7 @@ void startCPUProfiler(JSC::VM& vm)5{6// Capture the wall clock time when profiling starts (before creating stopwatch)7// This will be used as the profile's startTime8- s_profilingStartTime = MonotonicTime::now().approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;9+ s_profilingStartTime = MonotonicTime::now().approximateWallTime().secondsSinceEpoch().value() * 1000000.0;1011// Create a stopwatch and start it12auto stopwatch = WTF::Stopwatch::create();13@@ -364,7 +364,7 @@ void stopCPUProfiler(JSC::VM& vm, WTF::String* outJSON14auto& stackTrace = stackTraces[idx];15if (stackTrace.frames.isEmpty()) {16samples.append(1);17- double currentTime = stackTrace.timestamp.approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;18+ double currentTime = stackTrace.timestamp.approximateWallTime().secondsSinceEpoch().value() * 1000000.0;19double delta = std::max(0.0, currentTime - lastTime);20timeDeltas.append(static_cast<long long>(delta));21lastTime = currentTime;22@@ -538,7 +538,7 @@ void stopCPUProfiler(JSC::VM& vm, WTF::String* outJSON2324samples.append(currentParentId);2526- double currentTime = stackTrace.timestamp.approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;27+ double currentTime = stackTrace.timestamp.approximateWallTime().secondsSinceEpoch().value() * 1000000.0;28double delta = std::max(0.0, currentTime - lastTime);29timeDeltas.append(static_cast<long long>(delta));30lastTime = currentTime;31@@ -629,7 +629,7 @@ void stopCPUProfiler(JSC::VM& vm, WTF::String* outJSON32for (size_t idx : sortedIndices) {33auto& stackTrace = stackTraces[idx];3435- double currentTime = stackTrace.timestamp.approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;36+ double currentTime = stackTrace.timestamp.approximateWallTime().secondsSinceEpoch().value() * 1000000.0;37long long deltaUs = static_cast<long long>(std::max(0.0, currentTime - lastTime));38totalTimeUs += deltaUs;39lastTime = currentTime;404142