@perfbase/mcp 1.0.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 +76 -0
- package/dist/decoder/decompress.d.ts +25 -0
- package/dist/decoder/decompress.d.ts.map +1 -0
- package/dist/decoder/decompress.js +79 -0
- package/dist/decoder/decompress.js.map +1 -0
- package/dist/decoder/trie-walker.d.ts +34 -0
- package/dist/decoder/trie-walker.d.ts.map +1 -0
- package/dist/decoder/trie-walker.js +159 -0
- package/dist/decoder/trie-walker.js.map +1 -0
- package/dist/decoder/types.d.ts +188 -0
- package/dist/decoder/types.d.ts.map +1 -0
- package/dist/decoder/types.js +6 -0
- package/dist/decoder/types.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +309 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/profile-metadata.d.ts +14 -0
- package/dist/resources/profile-metadata.d.ts.map +1 -0
- package/dist/resources/profile-metadata.js +41 -0
- package/dist/resources/profile-metadata.js.map +1 -0
- package/dist/tools/cpu-intensive.d.ts +37 -0
- package/dist/tools/cpu-intensive.d.ts.map +1 -0
- package/dist/tools/cpu-intensive.js +64 -0
- package/dist/tools/cpu-intensive.js.map +1 -0
- package/dist/tools/database-queries.d.ts +33 -0
- package/dist/tools/database-queries.d.ts.map +1 -0
- package/dist/tools/database-queries.js +133 -0
- package/dist/tools/database-queries.js.map +1 -0
- package/dist/tools/memory-hogs.d.ts +38 -0
- package/dist/tools/memory-hogs.d.ts.map +1 -0
- package/dist/tools/memory-hogs.js +65 -0
- package/dist/tools/memory-hogs.js.map +1 -0
- package/dist/tools/most-called.d.ts +36 -0
- package/dist/tools/most-called.d.ts.map +1 -0
- package/dist/tools/most-called.js +59 -0
- package/dist/tools/most-called.js.map +1 -0
- package/dist/tools/n-plus-one.d.ts +29 -0
- package/dist/tools/n-plus-one.d.ts.map +1 -0
- package/dist/tools/n-plus-one.js +137 -0
- package/dist/tools/n-plus-one.js.map +1 -0
- package/dist/tools/slowest-functions.d.ts +36 -0
- package/dist/tools/slowest-functions.d.ts.map +1 -0
- package/dist/tools/slowest-functions.js +59 -0
- package/dist/tools/slowest-functions.js.map +1 -0
- package/dist/tools/summary.d.ts +42 -0
- package/dist/tools/summary.d.ts.map +1 -0
- package/dist/tools/summary.js +118 -0
- package/dist/tools/summary.js.map +1 -0
- package/dist/utils/formatting.d.ts +48 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +109 -0
- package/dist/utils/formatting.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @perfbase/mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server for analyzing PerfBase PHP profiler data.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
claude mcp add perfbase -- npx -y @perfbase/mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it! Restart Claude Code and you can analyze profiles:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Analyze the profile at /path/to/profile.bin
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Available Tools
|
|
18
|
+
|
|
19
|
+
| Tool | Description |
|
|
20
|
+
|------|-------------|
|
|
21
|
+
| `get_slowest_functions` | Functions sorted by total wall time |
|
|
22
|
+
| `get_most_called_functions` | Functions sorted by call count |
|
|
23
|
+
| `get_cpu_intensive_functions` | Functions sorted by CPU time |
|
|
24
|
+
| `get_memory_hogs` | Functions sorted by memory allocation |
|
|
25
|
+
| `get_database_queries` | Extract and analyze database operations |
|
|
26
|
+
| `detect_n_plus_one` | Find N+1 query patterns |
|
|
27
|
+
| `get_profile_summary` | Overall profile statistics |
|
|
28
|
+
|
|
29
|
+
## Profile Data Format
|
|
30
|
+
|
|
31
|
+
The MCP server expects PerfBase profile files which are:
|
|
32
|
+
1. MessagePack encoded
|
|
33
|
+
2. Brotli compressed
|
|
34
|
+
3. Base64 encoded
|
|
35
|
+
|
|
36
|
+
This is the format produced by `perfbase_get_data()`.
|
|
37
|
+
|
|
38
|
+
## Development
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Clone and install
|
|
42
|
+
git clone <repo>
|
|
43
|
+
cd mcp
|
|
44
|
+
npm install
|
|
45
|
+
|
|
46
|
+
# Build
|
|
47
|
+
npm run build
|
|
48
|
+
|
|
49
|
+
# Watch mode
|
|
50
|
+
npm run dev
|
|
51
|
+
|
|
52
|
+
# Run tests
|
|
53
|
+
npm test
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Local Testing
|
|
57
|
+
|
|
58
|
+
To test locally before publishing:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude mcp add perfbase -- node /path/to/extension/mcp/dist/index.js
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Generate a Test Profile
|
|
65
|
+
|
|
66
|
+
```php
|
|
67
|
+
<?php
|
|
68
|
+
perfbase_enable('test', PERFBASE_FLAG_ALL);
|
|
69
|
+
// ... your code ...
|
|
70
|
+
perfbase_disable('test');
|
|
71
|
+
file_put_contents('profile.bin', perfbase_get_data());
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decompression and decoding utilities for PerfBase profile data.
|
|
3
|
+
* Handles base64 decoding, Brotli decompression, and MessagePack unpacking.
|
|
4
|
+
*/
|
|
5
|
+
import { ProfilingData } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Load and decode a PerfBase profile from a file path
|
|
8
|
+
* @param filePath Path to the profile file (base64-encoded, Brotli-compressed, MessagePack)
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadProfile(filePath: string): Promise<ProfilingData>;
|
|
11
|
+
/**
|
|
12
|
+
* Decode a PerfBase profile from base64 string
|
|
13
|
+
* @param base64Data Base64-encoded, Brotli-compressed, MessagePack data
|
|
14
|
+
*/
|
|
15
|
+
export declare function decodeProfile(base64Data: string): Promise<ProfilingData>;
|
|
16
|
+
/**
|
|
17
|
+
* Encode a ProfilingData object to base64 (for testing)
|
|
18
|
+
* @param data ProfilingData to encode
|
|
19
|
+
*/
|
|
20
|
+
export declare function encodeProfile(data: ProfilingData): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Validate that the data has the expected structure
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateProfilingData(data: unknown): data is ProfilingData;
|
|
25
|
+
//# sourceMappingURL=decompress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decompress.d.ts","sourceRoot":"","sources":["../../src/decoder/decompress.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA0B3C;;;GAGG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAI1E;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAW9E;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CASxE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,aAAa,CAa1E"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decompression and decoding utilities for PerfBase profile data.
|
|
3
|
+
* Handles base64 decoding, Brotli decompression, and MessagePack unpacking.
|
|
4
|
+
*/
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
import { brotliDecompress, brotliCompress } from 'node:zlib';
|
|
7
|
+
import { decode as msgpackDecode, encode as msgpackEncode } from '@msgpack/msgpack';
|
|
8
|
+
const brotliDecompressAsync = promisify(brotliDecompress);
|
|
9
|
+
const brotliCompressAsync = promisify(brotliCompress);
|
|
10
|
+
/**
|
|
11
|
+
* Decode base64 string to Buffer
|
|
12
|
+
*/
|
|
13
|
+
function base64Decode(base64) {
|
|
14
|
+
return Buffer.from(base64, 'base64');
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Decompress Brotli-compressed data
|
|
18
|
+
*/
|
|
19
|
+
async function decompressBrotli(compressed) {
|
|
20
|
+
return brotliDecompressAsync(compressed);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Decode MessagePack data to ProfilingData
|
|
24
|
+
*/
|
|
25
|
+
function decodeMessagePack(data) {
|
|
26
|
+
return msgpackDecode(data);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Load and decode a PerfBase profile from a file path
|
|
30
|
+
* @param filePath Path to the profile file (base64-encoded, Brotli-compressed, MessagePack)
|
|
31
|
+
*/
|
|
32
|
+
export async function loadProfile(filePath) {
|
|
33
|
+
const fs = await import('node:fs/promises');
|
|
34
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
35
|
+
return decodeProfile(content.trim());
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Decode a PerfBase profile from base64 string
|
|
39
|
+
* @param base64Data Base64-encoded, Brotli-compressed, MessagePack data
|
|
40
|
+
*/
|
|
41
|
+
export async function decodeProfile(base64Data) {
|
|
42
|
+
// Step 1: Base64 decode
|
|
43
|
+
const compressed = base64Decode(base64Data);
|
|
44
|
+
// Step 2: Brotli decompress
|
|
45
|
+
const decompressed = await decompressBrotli(compressed);
|
|
46
|
+
// Step 3: MessagePack decode
|
|
47
|
+
const data = decodeMessagePack(decompressed);
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Encode a ProfilingData object to base64 (for testing)
|
|
52
|
+
* @param data ProfilingData to encode
|
|
53
|
+
*/
|
|
54
|
+
export async function encodeProfile(data) {
|
|
55
|
+
// Step 1: MessagePack encode
|
|
56
|
+
const msgpacked = Buffer.from(msgpackEncode(data));
|
|
57
|
+
// Step 2: Brotli compress
|
|
58
|
+
const compressed = await brotliCompressAsync(msgpacked);
|
|
59
|
+
// Step 3: Base64 encode
|
|
60
|
+
return compressed.toString('base64');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Validate that the data has the expected structure
|
|
64
|
+
*/
|
|
65
|
+
export function validateProfilingData(data) {
|
|
66
|
+
if (typeof data !== 'object' || data === null) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
const obj = data;
|
|
70
|
+
// Required fields
|
|
71
|
+
if (!Array.isArray(obj.g))
|
|
72
|
+
return false; // glossary
|
|
73
|
+
if (!Array.isArray(obj.f))
|
|
74
|
+
return false; // files
|
|
75
|
+
if (typeof obj.t !== 'object' || obj.t === null)
|
|
76
|
+
return false; // trie
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=decompress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decompress.js","sourceRoot":"","sources":["../../src/decoder/decompress.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGpF,MAAM,qBAAqB,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAC1D,MAAM,mBAAmB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;AAEtD;;GAEG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,KAAK,UA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AC9C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,GAAG,GAAG,IAA+B,CAAC;IAE5C,kBAAkB;IAClB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC,CAAE,WAAW;IACrD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC,CAAE,QAAQ;IAClD,IAAI,OAAO,GAAG,CAAC,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,CAAE,OAAO;IAEvE,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trie traversal utilities for reconstructing function call paths
|
|
3
|
+
* from the compressed trie structure.
|
|
4
|
+
*/
|
|
5
|
+
import { ProfilingData, FunctionInfo } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Walk the trie and collect all function info with reconstructed paths
|
|
8
|
+
*/
|
|
9
|
+
export declare function walkTrie(data: ProfilingData, spanName?: string): FunctionInfo[];
|
|
10
|
+
/**
|
|
11
|
+
* Get all unique function names from the glossary
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAllFunctionNames(data: ProfilingData): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Get all span names from the profile
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSpanNames(data: ProfilingData): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Count total number of function entries in the trie
|
|
20
|
+
*/
|
|
21
|
+
export declare function countFunctions(data: ProfilingData): number;
|
|
22
|
+
/**
|
|
23
|
+
* Filter functions by name pattern (case-insensitive)
|
|
24
|
+
*/
|
|
25
|
+
export declare function filterByName(functions: FunctionInfo[], pattern: string): FunctionInfo[];
|
|
26
|
+
/**
|
|
27
|
+
* Filter functions that look like database queries
|
|
28
|
+
*/
|
|
29
|
+
export declare function filterDatabaseFunctions(functions: FunctionInfo[]): FunctionInfo[];
|
|
30
|
+
/**
|
|
31
|
+
* Sort functions by a numeric field in descending order
|
|
32
|
+
*/
|
|
33
|
+
export declare function sortByField<K extends keyof FunctionInfo>(functions: FunctionInfo[], field: K, limit?: number): FunctionInfo[];
|
|
34
|
+
//# sourceMappingURL=trie-walker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trie-walker.d.ts","sourceRoot":"","sources":["../../src/decoder/trie-walker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EAGb,YAAY,EAEb,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,aAAa,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,YAAY,EAAE,CAmBhB;AA4ED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE,CAEjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE,CAE1D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAqB1D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE,MAAM,GACd,YAAY,EAAE,CAOhB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAoBjF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,YAAY,EACtD,SAAS,EAAE,YAAY,EAAE,EACzB,KAAK,EAAE,CAAC,EACR,KAAK,CAAC,EAAE,MAAM,GACb,YAAY,EAAE,CAWhB"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trie traversal utilities for reconstructing function call paths
|
|
3
|
+
* from the compressed trie structure.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Walk the trie and collect all function info with reconstructed paths
|
|
7
|
+
*/
|
|
8
|
+
export function walkTrie(data, spanName) {
|
|
9
|
+
const results = [];
|
|
10
|
+
const glossary = data.g;
|
|
11
|
+
const files = data.f;
|
|
12
|
+
// Get spans to process
|
|
13
|
+
const spansToProcess = spanName
|
|
14
|
+
? { [spanName]: data.t[spanName] }
|
|
15
|
+
: data.t;
|
|
16
|
+
for (const [span, roots] of Object.entries(spansToProcess)) {
|
|
17
|
+
if (!roots)
|
|
18
|
+
continue;
|
|
19
|
+
for (const root of roots) {
|
|
20
|
+
walkNode(root, [], glossary, files, results);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return results;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Recursively walk a trie node and collect function info
|
|
27
|
+
*/
|
|
28
|
+
function walkNode(node, pathIndices, glossary, files, results) {
|
|
29
|
+
const keys = node.k;
|
|
30
|
+
const children = node.h;
|
|
31
|
+
const value = node.v;
|
|
32
|
+
// Process each key at this level
|
|
33
|
+
for (let i = 0; i < keys.length; i++) {
|
|
34
|
+
const glossaryIdx = keys[i];
|
|
35
|
+
const currentPath = [...pathIndices, glossaryIdx];
|
|
36
|
+
// If there's a child node at this index, recurse
|
|
37
|
+
if (children && children[i]) {
|
|
38
|
+
walkNode(children[i], currentPath, glossary, files, results);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// If this node has function data, add it to results
|
|
42
|
+
if (value) {
|
|
43
|
+
const entry = glossary[value.g];
|
|
44
|
+
if (entry) {
|
|
45
|
+
const info = buildFunctionInfo(value, entry, pathIndices, glossary, files);
|
|
46
|
+
results.push(info);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build a FunctionInfo from FunctionData and path
|
|
52
|
+
*/
|
|
53
|
+
function buildFunctionInfo(data, entry, pathIndices, glossary, files) {
|
|
54
|
+
// Reconstruct call path from indices
|
|
55
|
+
const pathNames = pathIndices.map((idx) => glossary[idx]?.n ?? `<unknown:${idx}>`);
|
|
56
|
+
const callPath = pathNames.length > 0
|
|
57
|
+
? `${pathNames.join(' > ')} > ${entry.n}`
|
|
58
|
+
: entry.n;
|
|
59
|
+
// Get file path if available
|
|
60
|
+
const file = entry.f !== undefined ? files[entry.f] : undefined;
|
|
61
|
+
return {
|
|
62
|
+
callPath,
|
|
63
|
+
name: entry.n,
|
|
64
|
+
file,
|
|
65
|
+
line: entry.l,
|
|
66
|
+
callCount: data.c,
|
|
67
|
+
totalWallTime: data.w,
|
|
68
|
+
avgWallTime: data.c > 0 ? data.w / data.c : 0,
|
|
69
|
+
minWallTime: data.wn,
|
|
70
|
+
maxWallTime: data.wx,
|
|
71
|
+
totalCpuTime: data.u,
|
|
72
|
+
avgCpuTime: data.c > 0 ? data.u / data.c : 0,
|
|
73
|
+
minCpuTime: data.un,
|
|
74
|
+
maxCpuTime: data.ux,
|
|
75
|
+
memoryAllocated: data.mt,
|
|
76
|
+
memoryPeak: data.mp,
|
|
77
|
+
memoryNet: data.m,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get all unique function names from the glossary
|
|
82
|
+
*/
|
|
83
|
+
export function getAllFunctionNames(data) {
|
|
84
|
+
return data.g.map((entry) => entry.n);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get all span names from the profile
|
|
88
|
+
*/
|
|
89
|
+
export function getSpanNames(data) {
|
|
90
|
+
return Object.keys(data.t);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Count total number of function entries in the trie
|
|
94
|
+
*/
|
|
95
|
+
export function countFunctions(data) {
|
|
96
|
+
let count = 0;
|
|
97
|
+
function countNode(node) {
|
|
98
|
+
if (node.v)
|
|
99
|
+
count++;
|
|
100
|
+
if (node.h) {
|
|
101
|
+
for (const child of node.h) {
|
|
102
|
+
if (child)
|
|
103
|
+
countNode(child);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const roots of Object.values(data.t)) {
|
|
108
|
+
if (roots) {
|
|
109
|
+
for (const root of roots) {
|
|
110
|
+
countNode(root);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return count;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Filter functions by name pattern (case-insensitive)
|
|
118
|
+
*/
|
|
119
|
+
export function filterByName(functions, pattern) {
|
|
120
|
+
const lowerPattern = pattern.toLowerCase();
|
|
121
|
+
return functions.filter((f) => f.name.toLowerCase().includes(lowerPattern) ||
|
|
122
|
+
f.callPath.toLowerCase().includes(lowerPattern));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Filter functions that look like database queries
|
|
126
|
+
*/
|
|
127
|
+
export function filterDatabaseFunctions(functions) {
|
|
128
|
+
const dbPatterns = [
|
|
129
|
+
/^pdo/i,
|
|
130
|
+
/^mysqli/i,
|
|
131
|
+
/^pg_/i,
|
|
132
|
+
/^mongo/i,
|
|
133
|
+
/^redis/i,
|
|
134
|
+
/^memcache/i,
|
|
135
|
+
/query/i,
|
|
136
|
+
/execute/i,
|
|
137
|
+
/prepare/i,
|
|
138
|
+
/fetch/i,
|
|
139
|
+
/->query\(/i,
|
|
140
|
+
/->execute\(/i,
|
|
141
|
+
/->prepare\(/i,
|
|
142
|
+
];
|
|
143
|
+
return functions.filter((f) => dbPatterns.some((pattern) => pattern.test(f.name) || pattern.test(f.callPath)));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Sort functions by a numeric field in descending order
|
|
147
|
+
*/
|
|
148
|
+
export function sortByField(functions, field, limit) {
|
|
149
|
+
const sorted = [...functions].sort((a, b) => {
|
|
150
|
+
const aVal = a[field];
|
|
151
|
+
const bVal = b[field];
|
|
152
|
+
if (typeof aVal === 'number' && typeof bVal === 'number') {
|
|
153
|
+
return bVal - aVal;
|
|
154
|
+
}
|
|
155
|
+
return 0;
|
|
156
|
+
});
|
|
157
|
+
return limit ? sorted.slice(0, limit) : sorted;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=trie-walker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trie-walker.js","sourceRoot":"","sources":["../../src/decoder/trie-walker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;GAEG;AACH,MAAM,UAAU,QAAQ,CACtB,IAAmB,EACnB,QAAiB;IAEjB,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IACxB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IAErB,uBAAuB;IACvB,MAAM,cAAc,GAAG,QAAQ;QAC7B,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE;QAClC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC,KAAK;YAAE,SAAS;QAErB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,QAAQ,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,SAAS,QAAQ,CACf,IAAc,EACd,WAAqB,EACrB,QAAyB,EACzB,KAAe,EACf,OAAuB;IAEvB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;IACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IACxB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC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C,CAAC,CAAC,EAAE,EAAE,CAC5B,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAC/E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,SAAyB,EACzB,KAAQ,EACR,KAAc;IAEd,MAAM,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACtB,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzD,OAAO,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces matching the PerfBase Rust serialization structs.
|
|
3
|
+
* Field names use short keys to minimize serialized size.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Glossary entry for function names
|
|
7
|
+
* Matches Rust: GlossaryEntry { name, file_idx, line }
|
|
8
|
+
*/
|
|
9
|
+
export interface GlossaryEntry {
|
|
10
|
+
/** Function name */
|
|
11
|
+
n: string;
|
|
12
|
+
/** File index into files array (optional) */
|
|
13
|
+
f?: number;
|
|
14
|
+
/** Line number (optional) */
|
|
15
|
+
l?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Function timing and memory data
|
|
19
|
+
* Matches Rust: FunctionData
|
|
20
|
+
* All times are in microseconds
|
|
21
|
+
*/
|
|
22
|
+
export interface FunctionData {
|
|
23
|
+
/** Call count */
|
|
24
|
+
c: number;
|
|
25
|
+
/** Total wall time (microseconds) */
|
|
26
|
+
w: number;
|
|
27
|
+
/** Min wall time (microseconds) */
|
|
28
|
+
wn: number;
|
|
29
|
+
/** Max wall time (microseconds) */
|
|
30
|
+
wx: number;
|
|
31
|
+
/** Total CPU time (microseconds) */
|
|
32
|
+
u: number;
|
|
33
|
+
/** Min CPU time (microseconds) */
|
|
34
|
+
un: number;
|
|
35
|
+
/** Max CPU time (microseconds) */
|
|
36
|
+
ux: number;
|
|
37
|
+
/** Memory total allocated */
|
|
38
|
+
mt: number;
|
|
39
|
+
/** Memory total current (at end of call) */
|
|
40
|
+
mc: number;
|
|
41
|
+
/** Memory min */
|
|
42
|
+
mn: number;
|
|
43
|
+
/** Memory peak */
|
|
44
|
+
mp: number;
|
|
45
|
+
/** Memory freed */
|
|
46
|
+
mf: number;
|
|
47
|
+
/** Memory net change */
|
|
48
|
+
m: number;
|
|
49
|
+
/** Glossary index for function name */
|
|
50
|
+
g: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Trie node representing a call stack path
|
|
54
|
+
* Matches Rust: TrieNode
|
|
55
|
+
*/
|
|
56
|
+
export interface TrieNode {
|
|
57
|
+
/** Keys (glossary indices) for child paths */
|
|
58
|
+
k: number[];
|
|
59
|
+
/** Children trie nodes (optional, same length as k) */
|
|
60
|
+
h?: TrieNode[];
|
|
61
|
+
/** Function data for this node (optional, leaf data) */
|
|
62
|
+
v?: FunctionData;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* System statistics captured during profiling
|
|
66
|
+
* Matches Rust: SystemStats
|
|
67
|
+
*/
|
|
68
|
+
export interface SystemStats {
|
|
69
|
+
/** Peak memory usage in bytes */
|
|
70
|
+
peak_memory?: number;
|
|
71
|
+
/** CPU usage percentage */
|
|
72
|
+
cpu_percent?: number;
|
|
73
|
+
/** Load average (1 minute) */
|
|
74
|
+
load_avg_1m?: number;
|
|
75
|
+
/** Total execution time (microseconds) */
|
|
76
|
+
total_time_us?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Histogram bucket for timing distribution
|
|
80
|
+
*/
|
|
81
|
+
export interface HistogramBucket {
|
|
82
|
+
/** Lower bound (microseconds) */
|
|
83
|
+
min: number;
|
|
84
|
+
/** Upper bound (microseconds) */
|
|
85
|
+
max: number;
|
|
86
|
+
/** Count of samples in this bucket */
|
|
87
|
+
count: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Top-level profiling data structure
|
|
91
|
+
* Matches Rust: ProfilingData (serialized form)
|
|
92
|
+
*/
|
|
93
|
+
export interface ProfilingData {
|
|
94
|
+
/** Glossary of function names */
|
|
95
|
+
g: GlossaryEntry[];
|
|
96
|
+
/** File paths array */
|
|
97
|
+
f: string[];
|
|
98
|
+
/** Trie structure keyed by span name */
|
|
99
|
+
t: Record<string, TrieNode[]>;
|
|
100
|
+
/** System statistics (optional) */
|
|
101
|
+
s?: SystemStats;
|
|
102
|
+
/** Timing histogram (optional) */
|
|
103
|
+
h?: HistogramBucket[];
|
|
104
|
+
/** Custom attributes */
|
|
105
|
+
a?: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Reconstructed function info with full path
|
|
109
|
+
* Used after trie traversal
|
|
110
|
+
*/
|
|
111
|
+
export interface FunctionInfo {
|
|
112
|
+
/** Full call path (e.g., "main > process > query") */
|
|
113
|
+
callPath: string;
|
|
114
|
+
/** Function name only */
|
|
115
|
+
name: string;
|
|
116
|
+
/** File path (if available) */
|
|
117
|
+
file?: string;
|
|
118
|
+
/** Line number (if available) */
|
|
119
|
+
line?: number;
|
|
120
|
+
/** Call count */
|
|
121
|
+
callCount: number;
|
|
122
|
+
/** Total wall time (microseconds) */
|
|
123
|
+
totalWallTime: number;
|
|
124
|
+
/** Average wall time (microseconds) */
|
|
125
|
+
avgWallTime: number;
|
|
126
|
+
/** Min wall time (microseconds) */
|
|
127
|
+
minWallTime: number;
|
|
128
|
+
/** Max wall time (microseconds) */
|
|
129
|
+
maxWallTime: number;
|
|
130
|
+
/** Total CPU time (microseconds) */
|
|
131
|
+
totalCpuTime: number;
|
|
132
|
+
/** Average CPU time (microseconds) */
|
|
133
|
+
avgCpuTime: number;
|
|
134
|
+
/** Min CPU time (microseconds) */
|
|
135
|
+
minCpuTime: number;
|
|
136
|
+
/** Max CPU time (microseconds) */
|
|
137
|
+
maxCpuTime: number;
|
|
138
|
+
/** Total memory allocated */
|
|
139
|
+
memoryAllocated: number;
|
|
140
|
+
/** Peak memory usage */
|
|
141
|
+
memoryPeak: number;
|
|
142
|
+
/** Net memory change */
|
|
143
|
+
memoryNet: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Profile metadata for resources
|
|
147
|
+
*/
|
|
148
|
+
export interface ProfileMetadata {
|
|
149
|
+
/** Span names in the profile */
|
|
150
|
+
spans: string[];
|
|
151
|
+
/** System statistics */
|
|
152
|
+
systemStats?: SystemStats;
|
|
153
|
+
/** Custom attributes */
|
|
154
|
+
attributes?: Record<string, string>;
|
|
155
|
+
/** Total function count */
|
|
156
|
+
functionCount: number;
|
|
157
|
+
/** File paths referenced */
|
|
158
|
+
files: string[];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* N+1 query detection result
|
|
162
|
+
*/
|
|
163
|
+
export interface NPlusOnePattern {
|
|
164
|
+
/** The repeated query pattern */
|
|
165
|
+
queryPattern: string;
|
|
166
|
+
/** Number of similar queries */
|
|
167
|
+
count: number;
|
|
168
|
+
/** Total time spent (microseconds) */
|
|
169
|
+
totalTime: number;
|
|
170
|
+
/** Call paths where this pattern occurs */
|
|
171
|
+
callPaths: string[];
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Database query info extracted from profile
|
|
175
|
+
*/
|
|
176
|
+
export interface DatabaseQuery {
|
|
177
|
+
/** Query or operation name */
|
|
178
|
+
query: string;
|
|
179
|
+
/** Call count */
|
|
180
|
+
callCount: number;
|
|
181
|
+
/** Total time (microseconds) */
|
|
182
|
+
totalTime: number;
|
|
183
|
+
/** Average time (microseconds) */
|
|
184
|
+
avgTime: number;
|
|
185
|
+
/** Call path where query occurs */
|
|
186
|
+
callPath: string;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/decoder/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,6CAA6C;IAC7C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,CAA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C5B,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/decoder/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|