profiler-md 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +523 -273
- package/dist/index.d.mts +14 -11
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/readme.md +15 -11
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -73,18 +73,21 @@ $ profiler-md --help
|
|
|
73
73
|
```js
|
|
74
74
|
import { readFile } from 'node:fs/promises'
|
|
75
75
|
import {
|
|
76
|
-
|
|
76
|
+
defaultIncludeRow,
|
|
77
77
|
defaultIsThirdPartyURL,
|
|
78
78
|
v8CpuProfileToMd,
|
|
79
79
|
v8HeapProfileToMd,
|
|
80
|
+
v8HeapSnapshotToMd,
|
|
80
81
|
} from 'profiler-md'
|
|
81
82
|
|
|
82
|
-
const
|
|
83
|
-
const
|
|
83
|
+
const cpuProfileData = await readFile(`example.cpuprofile`)
|
|
84
|
+
const heapProfileData = await readFile(`example.heapprofile`)
|
|
85
|
+
const heapSnapshotData = await readFile(`example.heapsnapshot`)
|
|
84
86
|
|
|
85
87
|
// Basic usage
|
|
86
|
-
console.log(v8CpuProfileToMd(
|
|
87
|
-
console.log(v8HeapProfileToMd(
|
|
88
|
+
console.log(v8CpuProfileToMd(cpuProfileData))
|
|
89
|
+
console.log(v8HeapProfileToMd(heapProfileData))
|
|
90
|
+
console.log(v8HeapSnapshotToMd(heapSnapshotData))
|
|
88
91
|
|
|
89
92
|
// Complex usage
|
|
90
93
|
const options = {
|
|
@@ -96,13 +99,14 @@ const options = {
|
|
|
96
99
|
defaultIsThirdPartyURL(url) ||
|
|
97
100
|
// Treat an additional vendor directory as third-party.
|
|
98
101
|
url.pathname.includes(`/vendor/`),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// Exclude
|
|
102
|
-
|
|
102
|
+
includeRow: row =>
|
|
103
|
+
defaultIncludeRow(row) &&
|
|
104
|
+
// Exclude rows from a specific file.
|
|
105
|
+
!row.location?.includes(`/path/to/project/src/noisy.js`),
|
|
103
106
|
}
|
|
104
|
-
console.log(v8CpuProfileToMd(
|
|
105
|
-
console.log(v8HeapProfileToMd(
|
|
107
|
+
console.log(v8CpuProfileToMd(cpuProfileData, options))
|
|
108
|
+
console.log(v8HeapProfileToMd(heapProfileData, options))
|
|
109
|
+
console.log(v8HeapSnapshotToMd(heapSnapshotData, options))
|
|
106
110
|
```
|
|
107
111
|
|
|
108
112
|
## Contributing
|