kopia lustrzana https://github.com/cyoung/stratux
Fix outdated imports. Cleanup.
rodzic
abe84edfae
commit
269ef27b50
BIN
test/packetrate
BIN
test/packetrate
Plik binarny nie jest wyświetlany.
|
@ -1,19 +1,18 @@
|
|||
package main
|
||||
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
// "time"
|
||||
"os"
|
||||
// "time"
|
||||
"bufio"
|
||||
"gonum.org/v1/plot"
|
||||
"gonum.org/v1/plot/plotter"
|
||||
"gonum.org/v1/plot/plotutil"
|
||||
"gonum.org/v1/plot/vg"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
"strconv"
|
||||
"github.com/gonum/plot"
|
||||
"github.com/gonum/plot/plotter"
|
||||
"github.com/gonum/plot/plotutil"
|
||||
"github.com/gonum/plot/vg"
|
||||
"sort"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -37,7 +36,7 @@ func main() {
|
|||
if err != nil {
|
||||
break
|
||||
}
|
||||
buf = strings.TrimFunc(buf, func(r rune) bool {return unicode.IsControl(r)})
|
||||
buf = strings.TrimFunc(buf, func(r rune) bool { return unicode.IsControl(r) })
|
||||
linesplit := strings.Split(buf, ",")
|
||||
if len(linesplit) < 2 { // Blank line or invalid.
|
||||
continue
|
||||
|
@ -53,10 +52,10 @@ func main() {
|
|||
|
||||
// Window number in current session.
|
||||
wnum := int64(i / (60 * 1000000000))
|
||||
// fmt.Printf("%d\n", curWindow)
|
||||
if wnum + windowOffset != curWindow { // Switched over.
|
||||
// fmt.Printf("%d\n", curWindow)
|
||||
if wnum+windowOffset != curWindow { // Switched over.
|
||||
curWindow = wnum + windowOffset
|
||||
fmt.Printf("ppm=%d\n", ppm[curWindow - 1])
|
||||
fmt.Printf("ppm=%d\n", ppm[curWindow-1])
|
||||
}
|
||||
ppm[curWindow]++
|
||||
}
|
||||
|
@ -80,7 +79,7 @@ func main() {
|
|||
|
||||
pts := make(plotter.XYs, len(ppm))
|
||||
i := 0
|
||||
for _,k := range keys {
|
||||
for _, k := range keys {
|
||||
v := ppm[int64(k)]
|
||||
fmt.Printf("%d, %d\n", k, v)
|
||||
pts[i].X = float64(k)
|
||||
|
@ -92,7 +91,7 @@ func main() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := p.Save(4 * vg.Inch, 4 * vg.Inch, "ppm.png"); err != nil {
|
||||
if err := p.Save(4*vg.Inch, 4*vg.Inch, "ppm.png"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue