Documentation
¶
Index ¶
- Constants
- Variables
- func CanonicalArgv(r ProcessRequest) []string
- func Collect(ctx context.Context, manifest Manifest, cfg CollectorConfig) error
- func ExtractImmutableArchive(data []byte, destination string) error
- func ExtractImmutableArchiveWithOps(data []byte, destination string, ops ArchiveOps) (err error)
- func HashArchive(data []byte) string
- func HashArgv(r ProcessRequest) string
- func StableNames(names []string) []string
- func ToolIdentity(executable string) (path, digest string, err error)
- func ToolVersion(ctx context.Context, executor Executor, tool string) (string, error)
- func ValidateOutput(dir string) error
- func ValidatePublicationBinding(binding PublicationBinding, binary BinaryIdentity, protocol ProtocolIdentity) error
- func VerifyToolIdentity(ctx context.Context, executor Executor, tool, digest, version string) error
- type AnalysisInput
- type AnalysisReport
- type ArchiveOps
- type ArchivedSource
- type BenchmarkBinary
- type BinaryIdentity
- type CampaignManifest
- type CellReport
- type Clock
- type CollectorConfig
- type Command
- type Execution
- type Executor
- type ExternalGates
- type ExtractedSource
- type GateArtifact
- type Manifest
- type Measurement
- type OSExecutor
- type Order
- type PhaseManifest
- type ProcessRequest
- type ProtocolIdentity
- type PublicationBinding
- type Result
- type RunManifest
- type ScheduleEntry
- type SourceMachineManifest
- type TrustRegistry
Constants ¶
const ( BootstrapResamples = 100000 AllocationCap = 25000.0 )
const ( SchemaVersion = "vec-bench-stat/v2" CampaignID = "VEC-BENCH-STAT" AmendmentVersion = "1.0.0-draft.1" CampaignVersion = AmendmentVersion PhaseSchemaVersion = "1.0.0" RunSchemaVersion = "1.0.0" SourceSchemaVersion = "1.0.0" GuardMargin = 0.10 LCBThreshold = 5.10 PairedBlocksPerCell = 20 BenchmarkPackage = "./internal/store/sqlite" LegacyBenchmark = "BenchmarkHydrateLegacyGetByID_N100" BatchBenchmark = "BenchmarkHydrateBatchGetByIDs_N100" )
const ( BinaryIdentitySchemaVersion = "binary-identity/v1" ProtocolIdentitySchemaVersion = "protocol-identity/v1" )
const ( ApprovedBuildIdentity = "go-test-c-trimpath-v1" QualificationPhase = "qualification" HeldOutPhase = "held-out" )
Variables ¶
var RequiredCells = [...]int{1, 2, 4}
Functions ¶
func CanonicalArgv ¶
func CanonicalArgv(r ProcessRequest) []string
func Collect ¶
func Collect(ctx context.Context, manifest Manifest, cfg CollectorConfig) error
Collect executes every schedule entry once for every requested measurement. A failed process is retained as a Result and never causes a replacement run.
func ExtractImmutableArchive ¶
func ExtractImmutableArchiveWithOps ¶
func ExtractImmutableArchiveWithOps(data []byte, destination string, ops ArchiveOps) (err error)
func HashArchive ¶
func HashArgv ¶
func HashArgv(r ProcessRequest) string
func StableNames ¶
func ToolIdentity ¶
func ToolVersion ¶
func ValidateOutput ¶
func ValidatePublicationBinding ¶
func ValidatePublicationBinding(binding PublicationBinding, binary BinaryIdentity, protocol ProtocolIdentity) error
Types ¶
type AnalysisInput ¶
type AnalysisInput struct {
Manifest Manifest
Results []Result
Raw map[string][]byte
Gates ExternalGates
Binary BenchmarkBinary
}
type AnalysisReport ¶
type AnalysisReport struct {
Status string // PASS, FAIL, BLOCKED, or INCONCLUSIVE
Cells []CellReport
Seed uint64
Resamples int
GuardMargin float64
Reasons []string
}
func Analyze ¶
func Analyze(in AnalysisInput) AnalysisReport
func AnalyzePublication ¶
func AnalyzePublication(dir string, gates ExternalGates, binary BenchmarkBinary) (AnalysisReport, error)
type ArchiveOps ¶
type ArchivedSource ¶
func ArchiveSource ¶
type BenchmarkBinary ¶
type BenchmarkBinary struct {
SourceCommit, ToolIdentity, BinaryPath, SHA256 string
Build ProcessRequest
BuildArgv []string
}
func PrepareBenchmarkBinary ¶
type BinaryIdentity ¶
type BinaryIdentity struct {
SchemaVersion string `json:"schema_version"`
BinarySHA256 string `json:"binary_sha256"`
SourceCommit string `json:"source_commit"`
SourceTreeSHA256 string `json:"source_tree_sha256"`
ToolSHA256 string `json:"tool_sha256"`
ArgvSHA256 string `json:"argv_sha256"`
ToolVersion string `json:"tool_version"`
BuildIdentity string `json:"build_identity"`
}
BinaryIdentity seals the exact executable and toolchain used by a campaign.
func PrepareIdentity ¶
func PrepareIdentity(ctx context.Context, executor Executor, sourceRoot, commit string, build ProcessRequest, binary string) (identity BinaryIdentity, err error)
PrepareIdentity is the sole trust pipeline: tool precheck, exact archive, owned extraction, build, tool postcheck, binary hash.
func (BinaryIdentity) CanonicalJSON ¶
func (b BinaryIdentity) CanonicalJSON() ([]byte, error)
func (BinaryIdentity) Digest ¶
func (b BinaryIdentity) Digest() (string, error)
func (BinaryIdentity) Hash ¶
func (b BinaryIdentity) Hash() (string, error)
func (*BinaryIdentity) UnmarshalJSON ¶
func (b *BinaryIdentity) UnmarshalJSON(data []byte) error
func (BinaryIdentity) Validate ¶
func (b BinaryIdentity) Validate() error
type CampaignManifest ¶
type CellReport ¶
type CollectorConfig ¶
type CollectorConfig struct {
OutputDir string
Measurements []Measurement
Command Command
Executor Executor
Clock Clock
}
type Command ¶
type Command func(ScheduleEntry, Measurement) (ProcessRequest, error)
Command receives the sealed schedule entry. It must return the complete command identity, including environment, for one fresh process.
type ExternalGates ¶
type ExternalGates struct {
// contains filtered or unexported fields
}
ExternalGates contains only preregistered file digests and structured gate files. Gate outcomes are never accepted from caller-provided booleans.
func LoadExternalGates ¶
func LoadExternalGates(registryPath, expectedRegistrySHA256 string, artifactPaths map[string]string) (ExternalGates, error)
LoadExternalGates loads only externally supplied, regular files. It does not create or approve either trust registries or gate artifacts.
type ExtractedSource ¶
func ExtractSource ¶
func ExtractSource(source ArchivedSource) (ExtractedSource, error)
type GateArtifact ¶
type Manifest ¶
type Manifest struct {
SchemaVersion string `json:"schema_version"`
Campaign CampaignManifest `json:"campaign"`
Phase PhaseManifest `json:"phase"`
Run RunManifest `json:"run"`
SourceMachine SourceMachineManifest `json:"source_machine"`
SourceCommit string `json:"source_commit"`
BenchmarkPackage string `json:"benchmark_package"`
LegacyBenchmark string `json:"legacy_benchmark"`
BatchBenchmark string `json:"batch_benchmark"`
Seed uint64 `json:"seed"`
Schedule []ScheduleEntry `json:"schedule"`
}
func (Manifest) CanonicalJSON ¶
func (Manifest) ManifestDigest ¶
func (*Manifest) UnmarshalJSON ¶
type Measurement ¶
type Measurement string
const ( MeasurementLegacy Measurement = "legacy" MeasurementBatch Measurement = "batch" )
type OSExecutor ¶
type OSExecutor struct{}
OSExecutor captures both streams and makes process identity unambiguous for a run.
func (OSExecutor) Execute ¶
func (OSExecutor) Execute(ctx context.Context, r ProcessRequest) Execution
type PhaseManifest ¶
type ProcessRequest ¶
type ProtocolIdentity ¶
type ProtocolIdentity struct {
SchemaVersion string `json:"schema_version"`
Campaign string `json:"campaign"`
Amendment string `json:"amendment"`
Phase string `json:"phase"`
ManifestSHA256 string `json:"manifest_sha256"`
ScheduleSHA256 string `json:"schedule_sha256"`
LegacyMeasurementSHA256 string `json:"legacy_measurement_sha256"`
BatchMeasurementSHA256 string `json:"batch_measurement_sha256"`
Resamples int `json:"resamples"`
Confidence float64 `json:"confidence"`
LCBThreshold float64 `json:"lcb_threshold"`
GuardThreshold float64 `json:"guard_threshold"`
EnvironmentSHA256 string `json:"environment_sha256"`
}
ProtocolIdentity seals the statistical protocol and all immutable inputs.
func (ProtocolIdentity) CanonicalJSON ¶
func (p ProtocolIdentity) CanonicalJSON() ([]byte, error)
func (ProtocolIdentity) Digest ¶
func (p ProtocolIdentity) Digest() (string, error)
func (ProtocolIdentity) Hash ¶
func (p ProtocolIdentity) Hash() (string, error)
func (*ProtocolIdentity) UnmarshalJSON ¶
func (p *ProtocolIdentity) UnmarshalJSON(data []byte) error
func (ProtocolIdentity) Validate ¶
func (p ProtocolIdentity) Validate() error
type PublicationBinding ¶
type PublicationBinding struct {
BinaryIdentitySHA256 string `json:"binary_identity_sha256"`
ProtocolIdentitySHA256 string `json:"protocol_identity_sha256"`
}
func (PublicationBinding) Validate ¶
func (b PublicationBinding) Validate(binary BinaryIdentity, protocol ProtocolIdentity) error
type Result ¶
type Result struct {
Cell int `json:"cell"`
Block int `json:"block"`
Order Order `json:"order"`
BlockID string `json:"block_id"`
RunID string `json:"run_id"`
Sequence int `json:"sequence"`
Measurement Measurement `json:"measurement"`
Request ProcessRequest `json:"request"`
PID int `json:"pid"`
ProcessIdentity string `json:"process_identity"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
ExitCode int `json:"exit_code"`
Failed bool `json:"failed"`
Error string `json:"error,omitempty"`
Benchmark string `json:"benchmark,omitempty"`
NsPerOp float64 `json:"ns_per_op,omitempty"`
BytesPerOp float64 `json:"bytes_per_op,omitempty"`
AllocsPerOp float64 `json:"allocs_per_op,omitempty"`
StdoutSHA256 string `json:"stdout_sha256"`
StderrSHA256 string `json:"stderr_sha256"`
RawStdout string `json:"raw_stdout"`
RawStderr string `json:"raw_stderr"`
}
type RunManifest ¶
type ScheduleEntry ¶
type SourceMachineManifest ¶
type TrustRegistry ¶
type TrustRegistry struct {
SchemaVersion string `json:"schema_version"`
CampaignID string `json:"campaign_id"`
AmendmentVersion string `json:"amendment_version"`
PhaseID string `json:"phase"`
SourceCommit string `json:"source_commit"`
TestBinarySHA256 string `json:"test_binary_sha256"`
Gates map[string]string `json:"gates"`
}