Compare commits

..
8 Commits
Author SHA1 Message Date
Jamie Wong aa9bef5078 1.23.0
Node.js CI / test (18.x) (push) Has been cancelled
Node.js CI / test (20.x) (push) Has been cancelled
Node.js CI / finish (push) Has been cancelled
2025-07-06 20:04:25 -07:00
Ryan Moeller 31974da6e3 Add support for FreeBSD's pmcstat callgraph format (#502)
* Let tests run without bash

* Import pmcstat callgraph format

This eliminates the need for stackcollapse-pmc.pl and its dependency on
Perl to import FreeBSD callgraphs.  Tracing can be done completely with
tools included in the base system.  For example:

  ```
  # kldload hwpmc
  # pmcstat -S instructions -O sample.out sleep 1
  # pmcstat -R sample.out -G sample.pmcstat.graph
  ```
2025-03-18 10:08:10 -07:00
Jamie Wong 1c254dcb3e 1.22.2 2025-02-15 13:02:35 -08:00
Jamie Wong b17f7eeee8 1.22.1 2025-02-15 12:55:08 -08:00
Philipp A. 0e153f0a2c Update to working open, switch to ESM (#499) 2025-02-15 12:49:27 -08:00
Jamie Wong e3d57d5bb5 Revert "Fix broken CLI dependency open (#498)"
This reverts commit 60daa0e321.
2025-02-12 22:09:00 -08:00
Philipp A. 60daa0e321 Fix broken CLI dependency open (#498) 2025-02-12 13:13:25 -08:00
Daniel Kukula c5b01beec3 Update README.md (#496) 2025-01-23 12:27:16 -08:00
14 changed files with 873 additions and 57 deletions
+6 -5
View File
@@ -15,18 +15,19 @@ jobs:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
env:
CI: true
- name: Try CLI
run: node bin/cli.mjs -v
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.node-version }}
@@ -37,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
+19
View File
@@ -1,3 +1,22 @@
## [1.23.0] - 2025-07-06
- Add support for FreeBSD's pmcstat callgraph format [[#502](https://github.com/jlfwong/speedscope/pull/502)] (by @ryan-moeller)
## [1.22.2] - 2025-02-15
- 1.22.1
- Update to working `open`, switch to ESM [[#499](https://github.com/jlfwong/speedscope/pull/499)] (by @flying-sheep)
- Revert "Fix broken CLI dependency `open`" [[#498](https://github.com/jlfwong/speedscope/pull/498)] (by @flying-sheep)
- Fix broken CLI dependency `open` [[#498](https://github.com/jlfwong/speedscope/pull/498)] (by @flying-sheep)
- Update README.md [[#496](https://github.com/jlfwong/speedscope/pull/496)] (by @dkuku)
## [1.22.1] - 2025-02-15
- Update to working `open`, switch to ESM [[#499](https://github.com/jlfwong/speedscope/pull/499)] (by @flying-sheep)
- Revert "Fix broken CLI dependency `open`" [[#498](https://github.com/jlfwong/speedscope/pull/498)] (by @flying-sheep)
- Fix broken CLI dependency `open` [[#498](https://github.com/jlfwong/speedscope/pull/498)] (by @flying-sheep)
- Update README.md [[#496](https://github.com/jlfwong/speedscope/pull/496)] (by @dkuku)
## [1.22.0] - 2025-01-16
- Add an example trace with rust mangling
+2 -2
View File
@@ -21,10 +21,10 @@ cd /var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-test-installation
Run this command, to switch to the test directory.
Inside of here, run `bin/cli.js`. This should open a copy of speedscope in browser.
Inside of here, run `bin/cli.mjs`. This should open a copy of speedscope in browser.
Try importing a profile from disk via the browse button and make sure it works.
Next, try running `bin/cli.js dist/release/perf-vertx*`. This should immediately open
Next, try running `bin/cli.mjs dist/release/perf-vertx*`. This should immediately open
speedscope in browser, and the perf-vertx file should load immediately.
## Create & publish the new release
+2
View File
@@ -37,6 +37,8 @@ speedscope is designed to ingest profiles from a variety of different profilers
- Java
- [Importing from asyncprofiler (Java)
](https://github.com/jlfwong/speedscope/wiki/Importing-from-async%E2%80%90profiler-(Java))
- Erlang/Elixir
- [eflambe](https://github.com/Stratus3D/eflambe)
- Native code
- [Importing from Instruments.app](https://github.com/jlfwong/speedscope/wiki/Importing-from-Instruments.app) (macOS)
- [Importing from `perf`](https://github.com/jlfwong/speedscope/wiki/Importing-from-perf-(linux)) (linux)
+19 -11
View File
@@ -1,10 +1,14 @@
#!/usr/bin/env node
const path = require('path')
const fs = require('fs')
const os = require('os')
const stream = require('stream')
import path from 'node:path'
import fs from 'node:fs'
import os from 'node:os'
import stream from 'node:stream'
import { fileURLToPath } from 'node:url'
const open = require('open')
import open from 'open'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const helpString = `Usage: speedscope [filepath]
@@ -52,7 +56,9 @@ async function main() {
}
if (process.argv.includes('--version') || process.argv.includes('-v')) {
console.log('v' + require('../package.json').version)
const json = fs.readFileSync(path.resolve(__dirname, '../package.json'), { encoding: 'utf-8' })
const { version } = JSON.parse(json)
console.log(`v${version}`)
return
}
@@ -87,14 +93,16 @@ async function main() {
fs.writeFileSync(jsPath, jsSource)
urlToOpen += `#localProfilePath=${jsPath}`
// For some silly reason, the OS X open command ignores any query parameters or hash parameters
// For some silly reason, the macOS `open` and Windows `start` commands ignore hash parameters
// passed as part of the URL. To get around this weird issue, we'll create a local HTML file
// that just redirects.
const htmlPath = path.join(os.tmpdir(), `${filePrefix}.html`)
console.log(`Creating temp file ${htmlPath}`)
fs.writeFileSync(htmlPath, `<script>window.location=${JSON.stringify(urlToOpen)}</script>`)
if (process.platform === 'darwin' || process.platform === 'win32') {
const htmlPath = path.join(os.tmpdir(), `${filePrefix}.html`)
console.log(`Creating temp file ${htmlPath}`)
fs.writeFileSync(htmlPath, `<script>window.location=${JSON.stringify(urlToOpen)}</script>`)
urlToOpen = `file://${htmlPath}`
urlToOpen = `file://${htmlPath}`
}
}
console.log('Opening', urlToOpen, 'in your default browser')
+124 -34
View File
@@ -1,18 +1,18 @@
{
"name": "speedscope",
"version": "1.22.0",
"version": "1.23.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "speedscope",
"version": "1.22.0",
"version": "1.23.0",
"license": "MIT",
"dependencies": {
"open": "7.2.0"
"open": "10.1.0"
},
"bin": {
"speedscope": "bin/cli.js"
"speedscope": "bin/cli.mjs"
},
"devDependencies": {
"@types/jest": "22.2.3",
@@ -3617,7 +3617,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
"dev": true,
"engines": {
"node": ">=12"
},
@@ -6119,6 +6118,7 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz",
"integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==",
"dev": true,
"bin": {
"is-docker": "cli.js"
},
@@ -6178,7 +6178,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
"integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
"dev": true,
"dependencies": {
"is-docker": "^3.0.0"
},
@@ -6196,7 +6195,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
"dev": true,
"bin": {
"is-docker": "cli.js"
},
@@ -7937,26 +7935,91 @@
}
},
"node_modules/open": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/open/-/open-7.2.0.tgz",
"integrity": "sha512-4HeyhxCvBTI5uBePsAdi55C5fmqnWZ2e2MlmvWi5KW5tdH5rxoiv/aMtbeVxKZc3eWkT1GymMnLG8XC4Rq4TDQ==",
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz",
"integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==",
"license": "MIT",
"dependencies": {
"is-docker": "^2.0.0",
"is-wsl": "^2.1.1"
"default-browser": "^5.2.1",
"define-lazy-prop": "^3.0.0",
"is-inside-container": "^1.0.0",
"is-wsl": "^3.1.0"
},
"engines": {
"node": ">=8"
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open/node_modules/bundle-name": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz",
"integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==",
"license": "MIT",
"dependencies": {
"run-applescript": "^7.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open/node_modules/default-browser": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz",
"integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==",
"license": "MIT",
"dependencies": {
"bundle-name": "^4.1.0",
"default-browser-id": "^5.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open/node_modules/default-browser-id": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz",
"integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open/node_modules/is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz",
"integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==",
"license": "MIT",
"dependencies": {
"is-docker": "^2.0.0"
"is-inside-container": "^1.0.0"
},
"engines": {
"node": ">=8"
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open/node_modules/run-applescript": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz",
"integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/optionator": {
@@ -13519,8 +13582,7 @@
"define-lazy-prop": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
"dev": true
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg=="
},
"define-properties": {
"version": "1.1.2",
@@ -15516,7 +15578,8 @@
"is-docker": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz",
"integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw=="
"integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==",
"dev": true
},
"is-extendable": {
"version": "0.1.1",
@@ -15555,7 +15618,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
"integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
"dev": true,
"requires": {
"is-docker": "^3.0.0"
},
@@ -15563,8 +15625,7 @@
"is-docker": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
"dev": true
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="
}
}
},
@@ -17024,21 +17085,50 @@
}
},
"open": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/open/-/open-7.2.0.tgz",
"integrity": "sha512-4HeyhxCvBTI5uBePsAdi55C5fmqnWZ2e2MlmvWi5KW5tdH5rxoiv/aMtbeVxKZc3eWkT1GymMnLG8XC4Rq4TDQ==",
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz",
"integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==",
"requires": {
"is-docker": "^2.0.0",
"is-wsl": "^2.1.1"
"default-browser": "^5.2.1",
"define-lazy-prop": "^3.0.0",
"is-inside-container": "^1.0.0",
"is-wsl": "^3.1.0"
},
"dependencies": {
"is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"bundle-name": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz",
"integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==",
"requires": {
"is-docker": "^2.0.0"
"run-applescript": "^7.0.0"
}
},
"default-browser": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz",
"integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==",
"requires": {
"bundle-name": "^4.1.0",
"default-browser-id": "^5.0.0"
}
},
"default-browser-id": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz",
"integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA=="
},
"is-wsl": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz",
"integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==",
"requires": {
"is-inside-container": "^1.0.0"
}
},
"run-applescript": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz",
"integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A=="
}
}
},
+4 -4
View File
@@ -1,11 +1,11 @@
{
"name": "speedscope",
"version": "1.22.0",
"version": "1.23.0",
"description": "",
"repository": "jlfwong/speedscope",
"main": "index.js",
"bin": {
"speedscope": "./bin/cli.js"
"speedscope": "./bin/cli.mjs"
},
"scripts": {
"deploy": "./scripts/deploy.sh",
@@ -19,7 +19,7 @@
"serve": "tsx scripts/dev-server.ts"
},
"files": [
"bin/cli.js",
"bin/cli.mjs",
"dist/release/**",
"!*.map"
],
@@ -78,6 +78,6 @@
]
},
"dependencies": {
"open": "7.2.0"
"open": "10.1.0"
}
}
@@ -0,0 +1,38 @@
@ inst_retired.any [35705 samples]
# comment ok
// ignored
20.86% [7447] zfs_lz4_compress @ /boot/kernel/zfs.ko
100.0% [7447] zio_compress_data
100.0% [7447] zio_write_compress
100.0% [7447] zio_execute
100.0% [7447] taskqueue_run_locked @ /boot/kernel/kernel
100.0% [7447] taskqueue_thread_loop
100.0% [7447] fork_exit
14.44% [5156] fletcher_2_native @ /boot/kernel/zfs.ko
50.62% [2610] arc_cksum_verify
66.02% [1723] arc_buf_thaw
86.48% [1490] dmu_buf_will_dirty_impl
99.93% [1489] dmu_write_uio_dnode
100.0% [1489] zfs_write
100.0% [1489] zfs_freebsd_write
100.0% [1489] VOP_WRITE_APV @ /boot/kernel/kernel
100.0% [1489] vn_write
100.0% [1489] vn_io_fault_doio
100.0% [1489] vn_io_fault1
100.0% [1489] vn_io_fault
100.0% [1489] dofilewrite
100.0% [1489] kern_pwritev
100.0% [1489] sys_pwrite
100.0% [1489] amd64_syscall
00.07% [1] dmu_write_impl @ /boot/kernel/zfs.ko
100.0% [1] dmu_write
100.0% [1] metaslab_set_unflushed_txg
100.0% [1] metaslab_unflushed_bump
100.0% [1] spa_flush_metaslabs
100.0% [1] spa_sync
100.0% [1] txg_sync_thread
100.0% [1] fork_exit @ /boot/kernel/kernel
invalid line
+34
View File
@@ -0,0 +1,34 @@
@ inst_retired.any [35705 samples]
20.86% [7447] zfs_lz4_compress @ /boot/kernel/zfs.ko
100.0% [7447] zio_compress_data
100.0% [7447] zio_write_compress
100.0% [7447] zio_execute
100.0% [7447] taskqueue_run_locked @ /boot/kernel/kernel
100.0% [7447] taskqueue_thread_loop
100.0% [7447] fork_exit
14.44% [5156] fletcher_2_native @ /boot/kernel/zfs.ko
50.62% [2610] arc_cksum_verify
66.02% [1723] arc_buf_thaw
86.48% [1490] dmu_buf_will_dirty_impl
99.93% [1489] dmu_write_uio_dnode
100.0% [1489] zfs_write
100.0% [1489] zfs_freebsd_write
100.0% [1489] VOP_WRITE_APV @ /boot/kernel/kernel
100.0% [1489] vn_write
100.0% [1489] vn_io_fault_doio
100.0% [1489] vn_io_fault1
100.0% [1489] vn_io_fault
100.0% [1489] dofilewrite
100.0% [1489] kern_pwritev
100.0% [1489] sys_pwrite
100.0% [1489] amd64_syscall
00.07% [1] dmu_write_impl @ /boot/kernel/zfs.ko
100.0% [1] dmu_write
100.0% [1] metaslab_set_unflushed_txg
100.0% [1] metaslab_unflushed_bump
100.0% [1] spa_flush_metaslabs
100.0% [1] spa_sync
100.0% [1] txg_sync_thread
100.0% [1] fork_exit @ /boot/kernel/kernel
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -e
for f in `find sample/profiles -name '*.zip' | grep -v Instruments`; do
@@ -0,0 +1,575 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`importFromPMCStatCallGraph 1`] = `
Object {
"frames": Array [
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "fork_exit",
"line": undefined,
"name": "fork_exit",
"selfWeight": 0,
"totalWeight": 7448,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "taskqueue_thread_loop",
"line": undefined,
"name": "taskqueue_thread_loop",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "taskqueue_run_locked",
"line": undefined,
"name": "taskqueue_run_locked",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zio_execute",
"line": undefined,
"name": "zio_execute",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zio_write_compress",
"line": undefined,
"name": "zio_write_compress",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zio_compress_data",
"line": undefined,
"name": "zio_compress_data",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zfs_lz4_compress",
"line": undefined,
"name": "zfs_lz4_compress",
"selfWeight": 7447,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "amd64_syscall",
"line": undefined,
"name": "amd64_syscall",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "sys_pwrite",
"line": undefined,
"name": "sys_pwrite",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "kern_pwritev",
"line": undefined,
"name": "kern_pwritev",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "dofilewrite",
"line": undefined,
"name": "dofilewrite",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_io_fault",
"line": undefined,
"name": "vn_io_fault",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_io_fault1",
"line": undefined,
"name": "vn_io_fault1",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_io_fault_doio",
"line": undefined,
"name": "vn_io_fault_doio",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_write",
"line": undefined,
"name": "vn_write",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "VOP_WRITE_APV",
"line": undefined,
"name": "VOP_WRITE_APV",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zfs_freebsd_write",
"line": undefined,
"name": "zfs_freebsd_write",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zfs_write",
"line": undefined,
"name": "zfs_write",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_write_uio_dnode",
"line": undefined,
"name": "dmu_write_uio_dnode",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_buf_will_dirty_impl",
"line": undefined,
"name": "dmu_buf_will_dirty_impl",
"selfWeight": 0,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "arc_buf_thaw",
"line": undefined,
"name": "arc_buf_thaw",
"selfWeight": 0,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "arc_cksum_verify",
"line": undefined,
"name": "arc_cksum_verify",
"selfWeight": 0,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "fletcher_2_native",
"line": undefined,
"name": "fletcher_2_native",
"selfWeight": 1490,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "txg_sync_thread",
"line": undefined,
"name": "txg_sync_thread",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "spa_sync",
"line": undefined,
"name": "spa_sync",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "spa_flush_metaslabs",
"line": undefined,
"name": "spa_flush_metaslabs",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "metaslab_unflushed_bump",
"line": undefined,
"name": "metaslab_unflushed_bump",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "metaslab_set_unflushed_txg",
"line": undefined,
"name": "metaslab_set_unflushed_txg",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_write",
"line": undefined,
"name": "dmu_write",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_write_impl",
"line": undefined,
"name": "dmu_write_impl",
"selfWeight": 0,
"totalWeight": 1,
},
],
"name": "simple.txt",
"stacks": Array [
"fork_exit;taskqueue_thread_loop;taskqueue_run_locked;zio_execute;zio_write_compress;zio_compress_data;zfs_lz4_compress 7,447",
"amd64_syscall;sys_pwrite;kern_pwritev;dofilewrite;vn_io_fault;vn_io_fault1;vn_io_fault_doio;vn_write;VOP_WRITE_APV;zfs_freebsd_write;zfs_write;dmu_write_uio_dnode;dmu_buf_will_dirty_impl;arc_buf_thaw;arc_cksum_verify;fletcher_2_native 1,489",
"fork_exit;txg_sync_thread;spa_sync;spa_flush_metaslabs;metaslab_unflushed_bump;metaslab_set_unflushed_txg;dmu_write;dmu_write_impl;dmu_buf_will_dirty_impl;arc_buf_thaw;arc_cksum_verify;fletcher_2_native 1",
],
}
`;
exports[`importFromPMCStatCallGraph with invalid lines 1`] = `
Object {
"frames": Array [
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "fork_exit",
"line": undefined,
"name": "fork_exit",
"selfWeight": 0,
"totalWeight": 7448,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "taskqueue_thread_loop",
"line": undefined,
"name": "taskqueue_thread_loop",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "taskqueue_run_locked",
"line": undefined,
"name": "taskqueue_run_locked",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zio_execute",
"line": undefined,
"name": "zio_execute",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zio_write_compress",
"line": undefined,
"name": "zio_write_compress",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zio_compress_data",
"line": undefined,
"name": "zio_compress_data",
"selfWeight": 0,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zfs_lz4_compress",
"line": undefined,
"name": "zfs_lz4_compress",
"selfWeight": 7447,
"totalWeight": 7447,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "amd64_syscall",
"line": undefined,
"name": "amd64_syscall",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "sys_pwrite",
"line": undefined,
"name": "sys_pwrite",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "kern_pwritev",
"line": undefined,
"name": "kern_pwritev",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "dofilewrite",
"line": undefined,
"name": "dofilewrite",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_io_fault",
"line": undefined,
"name": "vn_io_fault",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_io_fault1",
"line": undefined,
"name": "vn_io_fault1",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_io_fault_doio",
"line": undefined,
"name": "vn_io_fault_doio",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "vn_write",
"line": undefined,
"name": "vn_write",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/kernel",
"key": "VOP_WRITE_APV",
"line": undefined,
"name": "VOP_WRITE_APV",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zfs_freebsd_write",
"line": undefined,
"name": "zfs_freebsd_write",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "zfs_write",
"line": undefined,
"name": "zfs_write",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_write_uio_dnode",
"line": undefined,
"name": "dmu_write_uio_dnode",
"selfWeight": 0,
"totalWeight": 1489,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_buf_will_dirty_impl",
"line": undefined,
"name": "dmu_buf_will_dirty_impl",
"selfWeight": 0,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "arc_buf_thaw",
"line": undefined,
"name": "arc_buf_thaw",
"selfWeight": 0,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "arc_cksum_verify",
"line": undefined,
"name": "arc_cksum_verify",
"selfWeight": 0,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "fletcher_2_native",
"line": undefined,
"name": "fletcher_2_native",
"selfWeight": 1490,
"totalWeight": 1490,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "txg_sync_thread",
"line": undefined,
"name": "txg_sync_thread",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "spa_sync",
"line": undefined,
"name": "spa_sync",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "spa_flush_metaslabs",
"line": undefined,
"name": "spa_flush_metaslabs",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "metaslab_unflushed_bump",
"line": undefined,
"name": "metaslab_unflushed_bump",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "metaslab_set_unflushed_txg",
"line": undefined,
"name": "metaslab_set_unflushed_txg",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_write",
"line": undefined,
"name": "dmu_write",
"selfWeight": 0,
"totalWeight": 1,
},
Frame {
"col": undefined,
"file": "/boot/kernel/zfs.ko",
"key": "dmu_write_impl",
"line": undefined,
"name": "dmu_write_impl",
"selfWeight": 0,
"totalWeight": 1,
},
],
"name": "simple-with-invalids.txt",
"stacks": Array [
"fork_exit;taskqueue_thread_loop;taskqueue_run_locked;zio_execute;zio_write_compress;zio_compress_data;zfs_lz4_compress 7,447",
"amd64_syscall;sys_pwrite;kern_pwritev;dofilewrite;vn_io_fault;vn_io_fault1;vn_io_fault_doio;vn_write;VOP_WRITE_APV;zfs_freebsd_write;zfs_write;dmu_write_uio_dnode;dmu_buf_will_dirty_impl;arc_buf_thaw;arc_cksum_verify;fletcher_2_native 1,489",
"fork_exit;txg_sync_thread;spa_sync;spa_flush_metaslabs;metaslab_unflushed_bump;metaslab_set_unflushed_txg;dmu_write;dmu_write_impl;dmu_buf_will_dirty_impl;arc_buf_thaw;arc_cksum_verify;fletcher_2_native 1",
],
}
`;
exports[`importFromPMCStatCallGraph with invalid lines: indexToView 1`] = `0`;
exports[`importFromPMCStatCallGraph with invalid lines: profileGroup.name 1`] = `"simple-with-invalids.txt"`;
exports[`importFromPMCStatCallGraph: indexToView 1`] = `0`;
exports[`importFromPMCStatCallGraph: profileGroup.name 1`] = `"simple.txt"`;
+10
View File
@@ -23,6 +23,7 @@ import {importFromChromeHeapProfile} from './v8heapalloc'
import {isTraceEventFormatted, importTraceEvents} from './trace-event'
import {importFromCallgrind} from './callgrind'
import {importFromPapyrus} from './papyrus'
import {importFromPMCStatCallGraph} from './pmcstat-callgraph'
export async function importProfileGroupFromText(
fileName: string,
@@ -123,6 +124,9 @@ async function _importProfileGroup(dataSource: ProfileDataSource): Promise<Profi
} else if (fileName.startsWith('callgrind.')) {
console.log('Importing as Callgrind profile')
return importFromCallgrind(contents, fileName)
} else if (fileName.endsWith('.pmcstat.graph')) {
console.log('Importing as pmcstat callgraph format')
return toGroup(importFromPMCStatCallGraph(contents))
}
// Second pass: Try to guess what file format it is based on structure
@@ -204,6 +208,12 @@ async function _importProfileGroup(dataSource: ProfileDataSource): Promise<Profi
console.log('Importing as collapsed stack format')
return toGroup(fromBGFlameGraph)
}
const fromPMCStatCallGraph = importFromPMCStatCallGraph(contents)
if (fromPMCStatCallGraph) {
console.log('Importing as pmcstat callgraph format')
return toGroup(fromPMCStatCallGraph)
}
}
// Unrecognized format
+9
View File
@@ -0,0 +1,9 @@
import {checkProfileSnapshot} from '../lib/test-utils'
test('importFromPMCStatCallGraph', async () => {
await checkProfileSnapshot('./sample/profiles/pmcstat/simple.txt')
})
test('importFromPMCStatCallGraph with invalid lines', async () => {
await checkProfileSnapshot('./sample/profiles/pmcstat/simple-with-invalids.txt')
})
+30
View File
@@ -0,0 +1,30 @@
import {Profile, FrameInfo, StackListProfileBuilder} from '../lib/profile'
import {TextFileContent} from './utils'
export function importFromPMCStatCallGraph(contents: TextFileContent): Profile | null {
const profile = new StackListProfileBuilder()
const stack: FrameInfo[] = []
let file: string | undefined
let prevDuration = '0'
let prevIndent = -1
for (const line of contents.splitLines()) {
const match = /^( *)[\d.]+% \[(\d+)\]\s*(\S+)(?: @ (.*))?$/gm.exec(line)
if (!match) continue
const indent = match[1].length
if (indent <= prevIndent) {
const frames = stack.slice(0, prevIndent + 1).reverse()
const duration = parseInt(prevDuration, 10)
profile.appendSampleWithWeight(frames, duration)
}
const name = match[3]
file = match[4] || file
stack[indent] = {key: name, name: name, file: file}
prevDuration = match[2]
prevIndent = indent
}
if (prevIndent == -1) return null
const frames = stack.slice(0, prevIndent + 1).reverse()
const duration = parseInt(prevDuration, 10)
profile.appendSampleWithWeight(frames, duration)
return profile.build()
}