/
plot_scripts.go
164 lines (145 loc) · 3.05 KB
/
plot_scripts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package gnuplot
const (
cpuPlotPNG = `set term png size 1024,768
set output 'cpu.png'
set timefmt '%s'
set xdata time
set title 'CPU(Cores)'
set xlabel 'Time'
plot 'cpu.data' using 1:2 with lines`
memPlotPNG = `set term png size 1024,768
set output 'mem.png'
set timefmt '%s'
set xdata time
set title 'Mem(Mb)'
set xlabel 'Time'
plot 'mem.data' using 1:2 with lines`
latencyPlotPNG = `set term png size 1024,768
set output 'latency.png'
set title 'Latency(s)'
set xlabel 'Message'
f(x)=m*x+b
fit f(x) 'latency.data' using 1:2 via m,b
plot 'latency.data' using 1:2 with lines title 'Data', f(x) title 'Trend'`
lossPlotPNG = `set term png size 1024,768
set output 'loss.png';
set xlabel 'SeqId';
set ylabel 'Lost Count'`
lossPlotDumb = `set term dumb
set xlabel 'SeqId';
set ylabel 'Lost Count'`
cpuPlotDumb = `set term dumb
set timefmt '%s'
set xdata time
set title 'CPU(Cores)'
set xlabel 'Time'
plot 'cpu.data' using 1:2 with lines`
memPlotDumb = `set term dumb
set timefmt '%s'
set xdata time
set title 'Mem(Mb)'
set xlabel 'Time'
plot 'mem.data' using 1:2 with lines`
latencyPlotDumb = `set term dumb
set title 'Latency(s)'
set xlabel 'Message'
plot 'latency.data' using 1:2 with lines`
html = `
<html>
<div>
<div><b>Options</b><div>
<div>Image: %s</div>
<div>Total Log Stressors: %d</div>
<div>Lines Per Second: %d</div>
<div>Run Duration: %s</div>
<div>Payload Source: %s</div>
</div>
<div>
Latency of logs collected based on the time the log was generated and ingested
</div>
<table border="1">
<tr>
<th>Total</th>
<th>Size</th>
<th>Elapsed</th>
<th>Mean</th>
<th>Min</th>
<th>Max</th>
<th>Median</th>
</tr>
<tr>
<th>Msg</th>
<th></th>
<th>(s)</th>
<th>(s)</th>
<th>(s)</th>
<th>(s)</th>
<th>(s)</th>
</tr>
<tr>
<td>%d</td>
<td>%d</td>
<td>%s</td>
<td>%.3f</td>
<td>%.3f</td>
<td>%.3f</td>
<td>%.3f</td>
</tr>
</table>
<div>
<img src="cpu.png">
</div>
<div>
<img src="mem.png">
</div>
<div>
<img src="latency.png">
</div>
<div>
<img src="loss.png">
</div>
<div>
<table border="1">
<tr>
<th>Stream</th>
<th>Min Seq</th>
<th>Max Seq</th>
<th>Purged</th>
<th>Collected</th>
<th>Percent Collected</th>
</tr>
<tr>
%s
</table>
</div>
<div>
<code style="display:block;white-space:pre-wrap">
%s
</code>
</div>
</html>
`
markdown = `
# collector Functionl Benchmark Results
## Options
* Image: %s
* Total Log Stressors: %d
* Lines Per Second: %d
* Run Duration: %s
* Payload Source: %s
## Latency of logs collected based on the time the log was generated and ingested
Total Msg| Size | Elapsed (s) | Mean (s)| Min(s) | Max (s)| Median (s)
---------|------|-------------|---------|--------|--------|---
%d|%d|%s|%.3f|%.3f|%.3f|%.3f
![](cpu.png)
![](mem.png)
![](latency.png)
![](loss.png)
## Percent logs lost between first and last collected sequence ids
Stream | Min Seq | Max Seq | Purged | Collected | Percent Collected |
-------| ---------| --------| -------|-----------|--------------|
%s
## Config
%s
`
)