UNPKG

traceperf

Version:

High-performance function execution tracking and monitoring for Node.js

64 lines (63 loc) 1.64 kB
/** * Utilities for managing call stacks and function tracking */ /** * Extract the name of a function * * @param fn - The function to extract the name from * @returns The function name or a placeholder if not available */ export declare function getFunctionName(fn: Function): string; /** * Get the current call stack * * @returns An array of function names in the call stack */ export declare function getCallStack(): string[]; /** * CallStackManager - Manages a call stack for execution tracking */ export declare class CallStackManager { private _stack; /** * Push a function name onto the call stack * * @param name - The function name * @returns The current stack depth */ push(name: string): number; /** * Pop a function name from the call stack * * @returns The popped function name or undefined if the stack is empty */ pop(): string | undefined; /** * Get the current call stack * * @returns A copy of the current call stack */ getStack(): string[]; /** * Get the current stack depth * * @returns The current stack depth */ getDepth(): number; /** * Clear the call stack */ clear(): void; /** * Get the current function name (top of the stack) * * @returns The current function name or undefined if the stack is empty */ getCurrentFunction(): string | undefined; /** * Get the parent function name * * @returns The parent function name or undefined if there is no parent */ getParentFunction(): string | undefined; }