2022-06-15 23:36:47 +02:00
|
|
|
// Copyright 2022 wanderer <a_mirre at utb dot cz>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
//go:build ignore
|
|
|
|
// +build ignore
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"text/template"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2022-06-19 18:40:56 +02:00
|
|
|
// colAlign sets the alignment of latex table columns.
|
|
|
|
colAlign := []string{
|
2022-06-15 23:36:47 +02:00
|
|
|
"l",
|
|
|
|
"c",
|
|
|
|
"c",
|
|
|
|
"c",
|
|
|
|
"c",
|
|
|
|
"c",
|
|
|
|
}
|
|
|
|
results := []float64{
|
|
|
|
161.032187,
|
|
|
|
125.03484,
|
|
|
|
80321,
|
|
|
|
85.0362432,
|
|
|
|
-4.466,
|
|
|
|
66.0008,
|
|
|
|
}
|
2022-06-19 18:40:56 +02:00
|
|
|
colNames := []string{
|
2022-06-15 23:36:47 +02:00
|
|
|
"func name",
|
2022-06-19 17:28:05 +02:00
|
|
|
"min",
|
|
|
|
"max",
|
|
|
|
"mean",
|
|
|
|
"median",
|
|
|
|
"stdDev",
|
2022-06-15 23:36:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fName := "report.tex"
|
|
|
|
paths := []string{
|
|
|
|
"report.tmpl",
|
|
|
|
}
|
|
|
|
f, err := os.Create(fName)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
defer f.Close()
|
|
|
|
|
|
|
|
reportTemplate := template.Must(template.ParseFiles(paths...))
|
|
|
|
|
|
|
|
err = reportTemplate.Execute(f, struct {
|
|
|
|
Timestamp time.Time
|
2022-06-19 18:40:56 +02:00
|
|
|
ColNames []string
|
2022-06-15 23:36:47 +02:00
|
|
|
Results []float64
|
2022-06-19 18:40:56 +02:00
|
|
|
ColAlign []string
|
2022-06-15 23:36:47 +02:00
|
|
|
}{
|
|
|
|
Timestamp: time.Now(),
|
2022-06-19 18:40:56 +02:00
|
|
|
ColNames: colNames,
|
2022-06-15 23:36:47 +02:00
|
|
|
Results: results,
|
2022-06-19 18:40:56 +02:00
|
|
|
ColAlign: colAlign,
|
2022-06-15 23:36:47 +02:00
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
log.Println(err)
|
|
|
|
}
|
|
|
|
}
|