fix linux output bug

main
Ben Grewell 4 years ago
parent 9b7a2fa851
commit 788d06af34

@ -2,7 +2,9 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="fc2840de-29dc-4fca-8e0e-a283562f60ca" name="Default Changelist" comment=""> <list default="true" id="fc2840de-29dc-4fca-8e0e-a283562f60ca" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/reporter_linux.go" beforeDir="false" afterPath="$PROJECT_DIR$/reporter_linux.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/reporter_linux.go" beforeDir="false" afterPath="$PROJECT_DIR$/reporter_linux.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tests/client/client.go" beforeDir="false" afterPath="$PROJECT_DIR$/tests/client/client.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -17,7 +19,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="GOROOT" path="C:\Go" /> <component name="GOROOT" url="file:///usr/local/go" />
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
@ -51,6 +53,15 @@
</key> </key>
</component> </component>
<component name="RunManager" selected="Go Build.go build github.com/BGrewell/go-iperf/tests/client"> <component name="RunManager" selected="Go Build.go build github.com/BGrewell/go-iperf/tests/client">
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-i" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="go build github.com/BGrewell/go-iperf/cmd" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true"> <configuration name="go build github.com/BGrewell/go-iperf/cmd" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="go-iperf" /> <module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
@ -78,6 +89,16 @@
<directory value="$PROJECT_DIR$" /> <directory value="$PROJECT_DIR$" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-i" />
<framework value="gotest" />
<kind value="DIRECTORY" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/tests/client" /> <item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/tests/client" />

@ -57,6 +57,7 @@ func (r *Reporter) runLogProcessor() {
} }
for line := range tailer.Lines { for line := range tailer.Lines {
// TODO: For now this only cares about individual streams it ignores the sum lines // TODO: For now this only cares about individual streams it ignores the sum lines
fmt.Println(line.Text)
if len(line.Text) > 5 { if len(line.Text) > 5 {
id := line.Text[1:4] id := line.Text[1:4]
stream, err := strconv.Atoi(strings.TrimSpace(id)) stream, err := strconv.Atoi(strings.TrimSpace(id))
@ -64,7 +65,7 @@ func (r *Reporter) runLogProcessor() {
continue continue
} }
fields := strings.Fields(line.Text[5:]) fields := strings.Fields(line.Text[5:])
if len(fields) >= 6 { if len(fields) >= 9 {
if fields[0] == "local" { if fields[0] == "local" {
continue continue
} }
@ -85,7 +86,10 @@ func (r *Reporter) runLogProcessor() {
if err != nil { if err != nil {
log.Printf("failed to convert units: %s\n", err) log.Printf("failed to convert units: %s\n", err)
} }
retrans := strconv.Atoi(fields[6]) retrans, err := strconv.Atoi(fields[6])
if err != nil {
log.Printf("failed to convert units: %s\n", err)
}
cwndStr := fmt.Sprintf("%s%s", fields[7], fields[8]) cwndStr := fmt.Sprintf("%s%s", fields[7], fields[8])
cwnd, err := conversions.StringBitRateToInt(cwndStr) cwnd, err := conversions.StringBitRateToInt(cwndStr)
if err != nil { if err != nil {
@ -104,7 +108,7 @@ func (r *Reporter) runLogProcessor() {
Bytes: int(transferedBytes), Bytes: int(transferedBytes),
BitsPerSecond: float64(rate), BitsPerSecond: float64(rate),
Retransmissions: retrans, Retransmissions: retrans,
CongestionWindow: cwnd, CongestionWindow: int(cwnd),
Omitted: omitted, Omitted: omitted,
} }
r.ReportingChannel <- report r.ReportingChannel <- report

@ -14,7 +14,7 @@ func main() {
omitSec := 10 omitSec := 10
length := "65500" length := "65500"
c := iperf.NewClient("10.23.42.18") c := iperf.NewClient("10.254.100.100")
c.SetIncludeServer(includeServer) c.SetIncludeServer(includeServer)
c.SetTimeSec(runTime) c.SetTimeSec(runTime)
c.SetOmitSec(omitSec) c.SetOmitSec(omitSec)

Loading…
Cancel
Save