Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/lang/bun/files/patch-src_jsc_bindings_BunCPUProfiler.cpp
49052 views
1
-- Fix build with older JavaScriptCore: approximate<WTF::WallTime>() -> approximateWallTime().
2
3
--- src/jsc/bindings/BunCPUProfiler.cpp.orig 2026-05-14 00:23:23 UTC
4
+++ src/jsc/bindings/BunCPUProfiler.cpp
5
@@ -49,7 +49,7 @@ void startCPUProfiler(JSC::VM& vm)
6
{
7
// Capture the wall clock time when profiling starts (before creating stopwatch)
8
// This will be used as the profile's startTime
9
- s_profilingStartTime = MonotonicTime::now().approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;
10
+ s_profilingStartTime = MonotonicTime::now().approximateWallTime().secondsSinceEpoch().value() * 1000000.0;
11
12
// Create a stopwatch and start it
13
auto stopwatch = WTF::Stopwatch::create();
14
@@ -364,7 +364,7 @@ void stopCPUProfiler(JSC::VM& vm, WTF::String* outJSON
15
auto& stackTrace = stackTraces[idx];
16
if (stackTrace.frames.isEmpty()) {
17
samples.append(1);
18
- double currentTime = stackTrace.timestamp.approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;
19
+ double currentTime = stackTrace.timestamp.approximateWallTime().secondsSinceEpoch().value() * 1000000.0;
20
double delta = std::max(0.0, currentTime - lastTime);
21
timeDeltas.append(static_cast<long long>(delta));
22
lastTime = currentTime;
23
@@ -538,7 +538,7 @@ void stopCPUProfiler(JSC::VM& vm, WTF::String* outJSON
24
25
samples.append(currentParentId);
26
27
- double currentTime = stackTrace.timestamp.approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;
28
+ double currentTime = stackTrace.timestamp.approximateWallTime().secondsSinceEpoch().value() * 1000000.0;
29
double delta = std::max(0.0, currentTime - lastTime);
30
timeDeltas.append(static_cast<long long>(delta));
31
lastTime = currentTime;
32
@@ -629,7 +629,7 @@ void stopCPUProfiler(JSC::VM& vm, WTF::String* outJSON
33
for (size_t idx : sortedIndices) {
34
auto& stackTrace = stackTraces[idx];
35
36
- double currentTime = stackTrace.timestamp.approximate<WTF::WallTime>().secondsSinceEpoch().value() * 1000000.0;
37
+ double currentTime = stackTrace.timestamp.approximateWallTime().secondsSinceEpoch().value() * 1000000.0;
38
long long deltaUs = static_cast<long long>(std::max(0.0, currentTime - lastTime));
39
totalTimeUs += deltaUs;
40
lastTime = currentTime;
41
42