UNPKG

@specs-feup/lara

Version:

A js port of the popular framework for building source-to-source compilers

43 lines 1.77 kB
import { LaraJoinPoint } from "../../LaraJoinPoint.js"; import TimeUnits, { TimerUnit } from "../util/TimeUnits.js"; /** * Timer object, for timing sections of code. */ export default abstract class TimerBase<T extends LaraJoinPoint> { timeUnits: TimeUnits; filename: string | undefined; protected printUnit: boolean; protected print: boolean; private afterJp; constructor(unit?: TimerUnit, filename?: string); /** * Times the code of a given section. * * @param $start - Starting point of the time measure * @param prefix - Message that will appear before the time measure. If undefined, empty string will be used. * @param $end - Ending point of the time measure. If undefined, measure is done around starting point. * @returns Name of the variable that contains the value of the elapsed time. */ abstract time($start: T, prefix?: string, $end?: T): string | undefined; setPrintUnit(printUnit: boolean): this; setPrint(print: boolean): this; getUnit(): TimeUnits; /** * @returns The last join point that was inserted after the $end mark */ getAfterJp(): T | undefined; /** * Sets the join point that should be returned by .getAfterJp(). */ setAfterJp($afterJp: T | undefined): void; /** * Verifies that join point start is not undefined, that it is inside a function. * Additionally, if $end is not undefined, checks if it is inside the same function as $start. * * [Requires] global attribute 'ancestor'. * * @returns True if $start is a valid join point for the 'time' function */ protected _timeValidate($start: any, $end?: any, functionJpName?: string): boolean; } //# sourceMappingURL=TimerBase.d.ts.map