UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

48 lines (47 loc) 1.93 kB
import type { MergeableRecord } from './objects'; export declare const enum SummarizerType { Benchmark = "benchmark", Statistics = "statistics" } export interface CommonSummarizerConfiguration extends MergeableRecord { logger: (message: string) => void; } export interface SummarizedMeasurement<T = number> { min: T; max: T; median: T; /** total may be useless for some measurements, especially if they are weighted before (it is just the sum...)*/ total: T; /** average */ mean: number; /** standard deviation */ std: number; } export declare abstract class Summarizer<Output, Configuration extends CommonSummarizerConfiguration> { protected readonly config: Configuration; protected readonly log: CommonSummarizerConfiguration['logger']; protected constructor(config: Configuration); /** * First phase of the summary, can be used to extract all data of interest from the individual * benchmark or statistic results. This can write temporary files based on the configuration. * @param useTypeClassification - Whether to split the analysis based on the detected type (e.g. 'test', 'example', ...) */ abstract preparationPhase(useTypeClassification: boolean): Promise<void>; /** * Second phase of the summary, can be used to combine the data from the first phase * and produce some kind of "ultimate results". */ abstract summarizePhase(): Promise<Output>; } /** * Converts the summarized measurement to a CSV line. */ export declare function summarizedMeasurement2Csv(a: SummarizedMeasurement): string; /** * Generates the CSV header for summarized measurements. */ export declare function summarizedMeasurement2CsvHeader(prefix?: string): string; /** * Summarizes the given measurement data. */ export declare function summarizeMeasurement(data: number[], totalNumberOfDataPoints?: number): SummarizedMeasurement;