Skip to content
Myr

Read latest CPU profile by default

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Mark Erikson · committed by Mark Erikson · parent 4d53dc0 · Browse files · 1 file+10 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−4 removed

  • other:+10 added−4 removed

1 file+10 added−4 removed

modified:perf-testing/read-cpuprofile.js+10 added-4 removed
1import fs from "fs"2import {SourceMapConsumer} from "source-map"34const profileName = process.argv[2]4let profileName = process.argv[2]56if (!profileName) {7 const cpuProfiles = fs.readdirSync(".").filter(f => f.endsWith(".cpuprofile"))8 const [lastProfile] = cpuProfiles.slice(-1)6if (!profileName || !fs.existsSync(profileName)) {7 console.error("Usage: node read-cpuprofile.js <path-to-cpuprofile>")8 process.exit(1)9 if (!lastProfile) {10 console.error("Usage: node read-cpuprofile.js <path-to-cpuprofile>")11 process.exit(1)12 }13 console.log("Using latest profile: ", lastProfile)14 profileName = lastProfile15}1617const profile = JSON.parse(fs.readFileSync(profileName, "utf8"))18
551 unmodified lines