modify debugging
This commit is contained in:
4
.idea/workspace.xml
generated
4
.idea/workspace.xml
generated
@@ -7,7 +7,9 @@
|
|||||||
<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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/client.go" beforeDir="false" afterPath="$PROJECT_DIR$/client.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/client.go" beforeDir="false" afterPath="$PROJECT_DIR$/client.go" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/execute.go" beforeDir="false" afterPath="$PROJECT_DIR$/execute.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/cmd/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/main.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/server.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/shared.go" beforeDir="false" afterPath="$PROJECT_DIR$/shared.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" />
|
||||||
|
|||||||
@@ -495,6 +495,9 @@ func (c *Client) Start() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var exit chan int
|
var exit chan int
|
||||||
|
if c.Debug {
|
||||||
|
fmt.Printf("executing command: %s\n", cmd)
|
||||||
|
}
|
||||||
c.outputStream, c.errorStream, exit, c.cancel, err = ExecuteAsyncWithCancelReadIndicator(cmd, read)
|
c.outputStream, c.errorStream, exit, c.cancel, err = ExecuteAsyncWithCancelReadIndicator(cmd, read)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
69
cmd/main.go
69
cmd/main.go
@@ -5,42 +5,45 @@ import (
|
|||||||
//"github.com/BGrewell/go-conversions"
|
//"github.com/BGrewell/go-conversions"
|
||||||
//"github.com/BGrewell/go-iperf"
|
//"github.com/BGrewell/go-iperf"
|
||||||
//"time"
|
//"time"
|
||||||
|
"fmt"
|
||||||
|
"github.com/BGrewell/go-conversions"
|
||||||
|
"github.com/BGrewell/go-iperf"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
//s := iperf.NewServer()
|
s := iperf.NewServer()
|
||||||
//c := iperf.NewClient("127.0.0.1")
|
c := iperf.NewClient("127.0.0.1")
|
||||||
//includeServer := true
|
c.SetIncludeServer(true)
|
||||||
//c.IncludeServer = &includeServer
|
fmt.Println(s.Id)
|
||||||
//fmt.Println(s.Id)
|
fmt.Println(c.Id)
|
||||||
//fmt.Println(c.Id)
|
|
||||||
//
|
err := s.Start()
|
||||||
//err := s.Start()
|
if err != nil {
|
||||||
//if err != nil {
|
fmt.Println(err)
|
||||||
// fmt.Println(err)
|
}
|
||||||
//}
|
|
||||||
//
|
err = c.Start()
|
||||||
//err = c.Start()
|
if err != nil {
|
||||||
//if err != nil {
|
fmt.Println(err)
|
||||||
// fmt.Println(err)
|
}
|
||||||
//}
|
|
||||||
//
|
for c.Running {
|
||||||
//for c.Running {
|
time.Sleep(1 * time.Second)
|
||||||
// time.Sleep(1 * time.Second)
|
}
|
||||||
//}
|
|
||||||
//
|
fmt.Println("stopping server")
|
||||||
//fmt.Println("stopping server")
|
s.Stop()
|
||||||
//s.Stop()
|
|
||||||
//
|
fmt.Printf("Client exit code: %d\n", *c.ExitCode())
|
||||||
//fmt.Printf("Client exit code: %d\n", *c.ExitCode)
|
fmt.Printf("Server exit code: %d\n", *s.ExitCode)
|
||||||
//fmt.Printf("Server exit code: %d\n", *s.ExitCode)
|
iperf.Cleanup()
|
||||||
//iperf.Cleanup()
|
if c.Report().Error != "" {
|
||||||
//if c.Report.Error != "" {
|
fmt.Println(c.Report().Error)
|
||||||
// fmt.Println(c.Report.Error)
|
} else {
|
||||||
//} else {
|
fmt.Printf("Recv Rate: %s\n", conversions.IntBitRateToString(int64(c.Report().End.SumReceived.BitsPerSecond)))
|
||||||
// fmt.Printf("Recv Rate: %s\n", conversions.IntBitRateToString(int64(c.Report.End.SumReceived.BitsPerSecond)))
|
fmt.Printf("Send Rate: %s\n", conversions.IntBitRateToString(int64(c.Report().End.SumSent.BitsPerSecond)))
|
||||||
// fmt.Printf("Send Rate: %s\n", conversions.IntBitRateToString(int64(c.Report.End.SumSent.BitsPerSecond)))
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,6 @@ func (r *Reporter) runLogProcessor() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to tail log file: %v", err)
|
log.Fatalf("failed to tail log file: %v", err)
|
||||||
}
|
}
|
||||||
if DEBUG {
|
|
||||||
log.Printf("starting to watch log file: %s\n", r.LogFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@@ -66,16 +63,10 @@ func (r *Reporter) runLogProcessor() {
|
|||||||
if line == nil {
|
if line == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if DEBUG {
|
|
||||||
log.Printf("new line: %s\n", line)
|
|
||||||
}
|
|
||||||
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))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if DEBUG {
|
|
||||||
log.Printf("error converting stream id to int: %v\n", err)
|
|
||||||
}
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fields := strings.Fields(line.Text[5:])
|
fields := strings.Fields(line.Text[5:])
|
||||||
@@ -126,9 +117,6 @@ func (r *Reporter) runLogProcessor() {
|
|||||||
Omitted: omitted,
|
Omitted: omitted,
|
||||||
}
|
}
|
||||||
r.ReportingChannel <- report
|
r.ReportingChannel <- report
|
||||||
if DEBUG {
|
|
||||||
log.Println("added report to reporting channel")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case <-time.After(100 * time.Millisecond):
|
case <-time.After(100 * time.Millisecond):
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ func (s *Server) Start() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var exit chan int
|
var exit chan int
|
||||||
|
if s.Debug {
|
||||||
|
fmt.Printf("executing command: %s\n", cmd)
|
||||||
|
}
|
||||||
s.outputStream, s.errorStream, exit, s.cancel, err = ExecuteAsyncWithCancel(cmd)
|
s.outputStream, s.errorStream, exit, s.cancel, err = ExecuteAsyncWithCancel(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user