MCPcopy
hub / github.com/tsenart/vegeta / plotRun

Function plotRun

plot.go:63–109  ·  view source on GitHub ↗
(files []string, threshold int, title, output string)

Source from the content-addressed store, hash-verified

61}
62
63func plotRun(files []string, threshold int, title, output string) error {
64 dec, mc, err := decoder(files)
65 defer mc.Close()
66 if err != nil {
67 return err
68 }
69
70 out, err := file(output, true)
71 if err != nil {
72 return err
73 }
74 defer out.Close()
75
76 sigch := make(chan os.Signal, 1)
77 signal.Notify(sigch, os.Interrupt)
78
79 p := plot.New(
80 plot.Title(title),
81 plot.Downsample(threshold),
82 plot.Label(plot.ErrorLabeler),
83 )
84
85decode:
86 for {
87 select {
88 case <-sigch:
89 break decode
90 default:
91 var r vegeta.Result
92 if err = dec.Decode(&r); err != nil {
93 if err == io.EOF {
94 break decode
95 }
96 return err
97 }
98
99 if err = p.Add(&r); err != nil {
100 return err
101 }
102 }
103 }
104
105 p.Close()
106
107 _, err = p.WriteTo(out)
108 return err
109}

Callers 1

plotCmdFunction · 0.85

Calls 10

NewFunction · 0.92
TitleFunction · 0.92
DownsampleFunction · 0.92
LabelFunction · 0.92
decoderFunction · 0.85
fileFunction · 0.85
WriteToMethod · 0.80
CloseMethod · 0.65
AddMethod · 0.65
DecodeMethod · 0.45

Tested by

no test coverage detected