package core_bench

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file bench_result.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
open Core
open Poly
module Coefficient = Analysis_result.Coefficient

module Predictor_result = struct
  type t =
    { pred : Variable.t
    ; coefficient : Coefficient.t
    }
  [@@deriving fields ~getters, sexp]

  let estimate t = Coefficient.estimate t.coefficient
  let ci95 t = Coefficient.ci95 t.coefficient
end

(* This holds the result from a running a benchmark. It is returned by [get_benchmarks]
   and is used in benchmarks.sexp to hold the results for an individual benchmark *)
type t =
  { name : string
  ; key : int
  ; group_key : int option
  ; arg : int option
  ; (* This contains a list of predictors together with the R^2 value from the regression *)
    cycles : Predictor_result.t list * float
  ; nanos : Predictor_result.t list * float
  ; minor_allocated : float
  ; major_allocated : float
  ; promoted : float
  ; minor_gcs : float
  ; major_gcs : float
  ; compactions : float
  ; samples : string
  ; percentage : float
  ; speedup : float
  ; time_taken : Time_float.Span.t
  }
[@@deriving sexp]

(* These are here for convenient access *)
let nanos_coeff t =
  List.find_exn (fst t.nanos) ~f:(fun pred -> Predictor_result.pred pred = `Runs)
;;

let nanos_est t = Predictor_result.estimate (nanos_coeff t)

let cycles_coeff t =
  List.find_exn (fst t.cycles) ~f:(fun pred -> Predictor_result.pred pred = `Runs)
;;

let cycles_est t = Predictor_result.estimate (cycles_coeff t)
OCaml

Innovation. Community. Security.