INNER CODE UNIT · TypeScript

parseHdrHistogramText

hasura/graphql-bench · app/queries/src/executors/base/index.ts:19

export function parseHdrHistogramText(text: string): HDRHistogramParsedStats[] {
  let results: HDRHistogramParsedStats[] = []
  const lines = text.split('\n')
  for (let line of lines) {
    let entries = line.trim().split(/\s+/)
    // Careful of truthiness when parsing zero here:
    let valid = entries.length == 4 && entries.every((x) => !(isNaN(Number(x))))
    if (!valid) continue
    let [value, percentile, totalCount, ofOnePercentile] = entries
    results.push({ value, percentile, totalCount, ofOnePercentile })
  }
  return results
}

export function makeBenchmarkMetrics(
  params: BenchmarkMetricParams
): BenchmarkMetrics {
  const { name, histogram, basicHistogram, time, requests, response, geoMean, p501stHalf, p501stQuarter, p501stEighth, geoMean1stHalf, geoMean1stQuarter, geoMean1stEighth } = params

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…