@xylabs/profile
v5.0.90
Published
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Readme
@xylabs/profile
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Reference
@xylabs/profile
Type Aliases
| Type Alias | Description | | ------ | ------ | | Profiler | A record of named timing entries, where each key maps to an array of timestamps. |
Functions
| Function | Description | | ------ | ------ | | createProfiler | Creates a new empty profiler instance. | | profile | Records a timestamp for the given profile name. | | profileReport | Generates a report of elapsed times for each profiled entry. |
functions
createProfiler
function createProfiler(): Profiler;Creates a new empty profiler instance.
Returns
profile
function profile(profiler: Profiler, name: string): void;Records a timestamp for the given profile name.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| profiler | Profiler | The profiler instance to record into. |
| name | string | The name of the timing entry. |
Returns
void
profileReport
function profileReport(profiler: Profiler): Record<string, number>;Generates a report of elapsed times for each profiled entry.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| profiler | Profiler | The profiler instance to report on. |
Returns
Record<string, number>
A record mapping each profile name to its elapsed time in milliseconds, plus a '-all-' total.
type-aliases
Profiler
type Profiler = Record<string, number[]>;A record of named timing entries, where each key maps to an array of timestamps.
Part of sdk-js
Maintainers
License
See the LICENSE file for license details
