Help us shape the future of Go! Take the 2026 Go Developer Survey

score

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package score はベンチマークのスコアを収集グループ(GroupId)に紐づけて保存する。

スコアはベンチ実行スクリプトの標準出力にしか無く、計測結果と機械的に繋がっていなかった。 スコアを1つの snapshot として持たせることで、収集一覧・グラフ・CLI から 「この収集はスコアいくつの走行か」を引けるようにする。

スコアの見方は回ごとに違うので、数値1本(Score)に加えてベンチの生出力(Raw)も保持する。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(opts *collect.Options) *handler

Types

type Brief added in v0.6.0

type Brief struct {
	Value  int64
	Passed bool
	// ErrorCount / Target / DurationSec は、ベンチの実行スクリプトが送ってきたときだけ入る。
	ErrorCount  int    `json:",omitempty"`
	Target      string `json:",omitempty"`
	DurationSec int    `json:",omitempty"`
}

Brief は推移や比較に出すスコアの要点。ベンチの生出力(Raw)は大きいので持たない。

func (*Brief) Line added in v0.6.0

func (b *Brief) Line() string

Line は見出しの下に書く「18902(エラー 3 / 対象 isu1 / 120s)」。

func (*Brief) String added in v0.6.0

func (b *Brief) String() string

String は表のセルに入れる「18902」、失敗した走行なら「18902 (FAIL)」。

type Diff added in v0.6.0

type Diff struct {
	Before *Brief `json:",omitempty"`
	After  *Brief `json:",omitempty"`
}

Diff は2回の走行のスコア。片方に無ければ nil。

func (*Diff) String added in v0.6.0

func (d *Diff) String() string

String は「12345 -> 18902 (+6557, +53.1%)」。どちらかにエラーがあれば「 / エラー 5 -> 3」を足す。

type Value

type Value struct {
	// Score はスコア。回によらず「大きいほど良い」1本の数値。
	Score int64
	// Passed はベンチが成功したか。整合性チェック落ちなど、失敗した走行も記録する。
	Passed bool
	// Target は走行の対象(ホスト名など)。
	Target string
	// ErrorCount はベンチが報告したエラー件数。
	ErrorCount int
	// StartedAt / FinishedAt は走行区間。他の計測と突き合わせるのに使う。
	StartedAt  time.Time
	FinishedAt time.Time
	// Raw はベンチの生出力。回ごとに違う減点内訳などを後から読めるようにしておく。
	Raw string
}

Value は1回の走行の結果。snapshot の本体としてこの JSON が保存される。

func (*Value) Brief added in v0.6.0

func (v *Value) Brief() *Brief

func (*Value) Duration

func (v *Value) Duration() time.Duration

Duration は走行時間。開始か終了が空なら 0。

func (*Value) Summary

func (v *Value) Summary() string

Summary は収集一覧やイベントに出す1行の要約。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL