@mtharrison/pkg-profiler 2.0.0 → 2.2.0
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/README.md +12 -12
- package/dist/index.cjs +343 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +343 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/async-tracker.ts +128 -17
- package/src/dep-chain.ts +111 -0
- package/src/pkg-profile.ts +4 -0
- package/src/reporter/aggregate.ts +27 -3
- package/src/reporter/html.ts +152 -28
- package/src/sampler.ts +14 -1
- package/src/types.ts +2 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/logo.
|
|
2
|
+
<img src="assets/logo.png" width="120" height="120" alt="where-you-at logo">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">@mtharrison/pkg-profiler</h1>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
## Quick Start
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
import { start, stop } from
|
|
25
|
+
import { start, stop } from "@mtharrison/pkg-profiler";
|
|
26
26
|
|
|
27
27
|
await start();
|
|
28
28
|
// ... your code here ...
|
|
@@ -33,7 +33,7 @@ result.writeHtml(); // writes an HTML report to cwd
|
|
|
33
33
|
Or use the convenience wrapper:
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import { profile } from
|
|
36
|
+
import { profile } from "@mtharrison/pkg-profiler";
|
|
37
37
|
|
|
38
38
|
const result = await profile(async () => {
|
|
39
39
|
await build();
|
|
@@ -51,8 +51,8 @@ A self-contained HTML report that shows exactly which npm packages are eating yo
|
|
|
51
51
|
|
|
52
52
|
Start the V8 CPU sampling profiler. Safe no-op if already profiling.
|
|
53
53
|
|
|
54
|
-
| Option | Type | Default
|
|
55
|
-
|
|
54
|
+
| Option | Type | Default | Description |
|
|
55
|
+
| ---------- | -------- | ---------- | --------------------------------- |
|
|
56
56
|
| `interval` | `number` | V8 default | Sampling interval in microseconds |
|
|
57
57
|
|
|
58
58
|
### `stop()`
|
|
@@ -91,13 +91,13 @@ app.listen(3000);
|
|
|
91
91
|
|
|
92
92
|
Returned by `stop()` and `profile()`. Contains aggregated profiling data.
|
|
93
93
|
|
|
94
|
-
| Property | Type | Description
|
|
95
|
-
|
|
96
|
-
| `timestamp` | `string` | When the profile was captured
|
|
97
|
-
| `totalTimeUs` | `number` | Total sampled wall time in microseconds
|
|
98
|
-
| `packages` | `PackageEntry[]` | Package breakdown sorted by time descending
|
|
99
|
-
| `otherCount` | `number` | Number of packages below reporting threshold
|
|
100
|
-
| `projectName` | `string` | Project name from package.json
|
|
94
|
+
| Property | Type | Description |
|
|
95
|
+
| ------------- | ---------------- | -------------------------------------------- |
|
|
96
|
+
| `timestamp` | `string` | When the profile was captured |
|
|
97
|
+
| `totalTimeUs` | `number` | Total sampled wall time in microseconds |
|
|
98
|
+
| `packages` | `PackageEntry[]` | Package breakdown sorted by time descending |
|
|
99
|
+
| `otherCount` | `number` | Number of packages below reporting threshold |
|
|
100
|
+
| `projectName` | `string` | Project name from package.json |
|
|
101
101
|
|
|
102
102
|
#### `writeHtml(path?)`
|
|
103
103
|
|