From 187ef2afc68b81cd679b353ead73b5aca4c8f9f9 Mon Sep 17 00:00:00 2001 From: Harris Hancock Date: Tue, 20 Aug 2024 17:58:15 +0100 Subject: [PATCH] [nfc] Temporarily disable CPU profiling test case We need to revert the fix until we've diagnosed #2564. --- src/workerd/server/tests/inspector/driver.mjs | 93 ++++++++++--------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/src/workerd/server/tests/inspector/driver.mjs b/src/workerd/server/tests/inspector/driver.mjs index f9fae4ede2a..21d44ac7db4 100644 --- a/src/workerd/server/tests/inspector/driver.mjs +++ b/src/workerd/server/tests/inspector/driver.mjs @@ -59,49 +59,50 @@ test("Can repeatedly connect and disconnect to the inspector port", async () => } }); -test("Profiler mostly sees deriveBits() frames", async () => { - let inspectorClient = await connectInspector(await workerd.getListenInspectorPort()); - - // Enable and start profiling. - await inspectorClient.Profiler.enable(); - await inspectorClient.Profiler.start(); - - // Drive the worker with a test request. A single one is sufficient. - let httpPort = await workerd.getListenPort("http"); - const response = await fetch(`http://localhost:${httpPort}`); - await response.arrayBuffer(); - - // Stop and disable profiling. - const profile = await inspectorClient.Profiler.stop(); - await inspectorClient.Profiler.disable(); - - // Figure out which function name was most frequently sampled. - let hitCountMap = new Map(); - - for (let node of profile.profile.nodes) { - if (hitCountMap.get(node.callFrame.functionName) === undefined) { - hitCountMap.set(node.callFrame.functionName, 0); - } - hitCountMap.set(node.callFrame.functionName, - hitCountMap.get(node.callFrame.functionName) + node.hitCount); - } - - let max = { - name: null, - count: 0, - }; - - for (let [name, count] of hitCountMap) { - if (count > max.count) { - max.name = name; - max.count = count; - } - } - - // The most CPU-intensive function our test script runs is `deriveBits()`, so we expect that to be - // the most frequently sampled function. - assert.equal(max.name, "deriveBits"); - assert.notEqual(max.count, 0); - - await inspectorClient.close(); -}); +// TODO(soon): Re-enable once https://github.com/cloudflare/workerd/issues/2564 is solved. +// test("Profiler mostly sees deriveBits() frames", async () => { +// let inspectorClient = await connectInspector(await workerd.getListenInspectorPort()); + +// // Enable and start profiling. +// await inspectorClient.Profiler.enable(); +// await inspectorClient.Profiler.start(); + +// // Drive the worker with a test request. A single one is sufficient. +// let httpPort = await workerd.getListenPort("http"); +// const response = await fetch(`http://localhost:${httpPort}`); +// await response.arrayBuffer(); + +// // Stop and disable profiling. +// const profile = await inspectorClient.Profiler.stop(); +// await inspectorClient.Profiler.disable(); + +// // Figure out which function name was most frequently sampled. +// let hitCountMap = new Map(); + +// for (let node of profile.profile.nodes) { +// if (hitCountMap.get(node.callFrame.functionName) === undefined) { +// hitCountMap.set(node.callFrame.functionName, 0); +// } +// hitCountMap.set(node.callFrame.functionName, +// hitCountMap.get(node.callFrame.functionName) + node.hitCount); +// } + +// let max = { +// name: null, +// count: 0, +// }; + +// for (let [name, count] of hitCountMap) { +// if (count > max.count) { +// max.name = name; +// max.count = count; +// } +// } + +// // The most CPU-intensive function our test script runs is `deriveBits()`, so we expect that to be +// // the most frequently sampled function. +// assert.equal(max.name, "deriveBits"); +// assert.notEqual(max.count, 0); + +// await inspectorClient.close(); +// });