csvdump

package
v0.0.0-...-1dd1f65 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package csvdump handles outputting of analysis data as CSVs.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompilerWriter

type CompilerWriter csv.Writer

CompilerWriter wraps a CSV writer and makes it output compiler analyses.

func NewCompilerWriter

func NewCompilerWriter(w io.Writer) *CompilerWriter

NewCompilerWriter creates a new compiler writer over w.

func (*CompilerWriter) OnAnalysis

func (c *CompilerWriter) OnAnalysis(a analysis.Analysis)

OnAnalysis observes an analysis by emitting a CSV with compiler information.

Example

ExampleCompilerWriter_OnAnalysis is a testable example for CompilerWriter.OnAnalysis.

package main

import (
	"context"
	"os"

	"github.com/c4-project/c4t/internal/plan"
	"github.com/c4-project/c4t/internal/plan/analysis"
	"github.com/c4-project/c4t/internal/stage/analyser/csvdump"
)

func main() {
	an, _ := analysis.Analyse(context.Background(), plan.Mock())

	// nb: aside from the header, the actual order of compilers is not deterministic
	cw := csvdump.NewCompilerWriter(os.Stdout)
	cw.OnAnalysis(*an)

}
Output:

CompilerID,StyleID,ArchID,Opt,MOpt,MinCompile,AvgCompile,MaxCompile,MinRun,AvgRun,MaxRun,Ok,Filtered,Flagged,CompileFail,CompileTimeout,RunFail,RunTimeout
gcc,gcc,ppc.64le.power9,,,200,200,200,0,0,0,0,0,1,1,0,0,0
clang,gcc,x86,,,200,200,200,0,0,0,1,0,0,0,0,0,0

type StageWriter

type StageWriter csv.Writer

StageWriter wraps a CSV writer and makes it output stage analyses.

func NewStageWriter

func NewStageWriter(w io.Writer) *StageWriter

NewStageWriter creates a new stage writer over w.

func (*StageWriter) OnAnalysis

func (s *StageWriter) OnAnalysis(a analysis.Analysis)

OnAnalysis observes an analysis by emitting a CSV with stage information.

Example

ExampleStageWriter_OnAnalysis is a testable example for OnAnalysis.

package main

import (
	"context"
	"os"

	"github.com/c4-project/c4t/internal/stage/analyser/csvdump"

	"github.com/c4-project/c4t/internal/plan"
	"github.com/c4-project/c4t/internal/plan/analysis"
)

func main() {
	an, _ := analysis.Analyse(context.Background(), plan.Mock())

	sw := csvdump.NewStageWriter(os.Stdout)
	sw.OnAnalysis(*an)

}
Output:

Stage,Start,End,Duration

Jump to

Keyboard shortcuts

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