mathrok
Version:
AI-powered symbolic mathematics library combining traditional Computer Algebra System (CAS) capabilities with natural language processing for math problem solving
131 lines • 3.2 kB
TypeScript
/**
* Performance monitoring and tracking utilities
* Tracks execution time, memory usage, and operation metrics
*/
import type { PerformanceMetrics } from '../../types/core.js';
/**
* Performance statistics
*/
interface PerformanceStats {
readonly count: number;
readonly totalTime: number;
readonly averageTime: number;
readonly minTime: number;
readonly maxTime: number;
readonly lastTime: number;
}
/**
* Performance tracker class
*/
export declare class PerformanceTracker {
private readonly operations;
private readonly errors;
private profilingActive;
private profilingStartTime;
private readonly maxHistorySize;
constructor(maxHistorySize?: number);
/**
* Record an operation timing
*/
recordOperation(name: string, duration: number, memoryUsage?: number): void;
/**
* Record an error
*/
recordError(operation: string, error: Error): void;
/**
* Start profiling session
*/
startProfiling(): void;
/**
* Stop profiling session and return metrics
*/
stopProfiling(): {
duration: number;
operations: number;
};
/**
* Get current performance metrics
*/
getMetrics(): PerformanceMetrics;
/**
* Get statistics for a specific operation
*/
getOperationStats(operationName: string): PerformanceStats;
/**
* Get all operation names
*/
getOperationNames(): string[];
/**
* Get error count for an operation
*/
getErrorCount(operationName: string): number;
/**
* Get total error count
*/
getTotalErrorCount(): number;
/**
* Get recent errors for an operation
*/
getRecentErrors(operationName: string, count?: number): Error[];
/**
* Reset all metrics
*/
reset(): void;
/**
* Get performance summary
*/
getSummary(): Record<string, any>;
/**
* Export metrics as JSON
*/
exportMetrics(): string;
/**
* Get performance statistics in the format expected by tests
*/
getStats(): {
totalOperations: number;
averageTime: number;
totalTime: number;
operationCounts: Record<string, number>;
memoryUsage: number;
cacheHits: number;
cacheMisses: number;
parseTime: number;
solveTime: number;
explainTime: number;
};
/**
* Create a performance report
*/
createReport(): string;
/**
* Get current memory usage (approximate)
*/
private getCurrentMemoryUsage;
/**
* Estimate memory delta (simplified)
*/
private estimateMemoryDelta;
/**
* Get cache hits (placeholder - would integrate with actual cache)
*/
private getCacheHits;
/**
* Get cache misses (placeholder - would integrate with actual cache)
*/
private getCacheMisses;
/**
* Format bytes for human reading
*/
private formatBytes;
/**
* Check if profiling is active
*/
isProfiling(): boolean;
/**
* Get profiling duration
*/
getProfilingDuration(): number;
}
export {};
//# sourceMappingURL=index.d.ts.map