Exemplo n.º 1
0
func printTrip(emits []*dccp.LogRecord) {
	reducer := dccp_gauge.NewLogReducer()
	for _, rec := range emits {
		reducer.Write(rec)
	}
	trips := dccp_gauge.TripMapToSlice(reducer.Trips())
	sort.Sort(TripSeqNoSort(trips))

	prints := make([]*PrintRecord, 0)
	for _, t := range trips {
		prints = append(prints, printNop)
		for _, r := range t.Forward {
			p := printRecord(r)
			if p != nil {
				prints = append(prints, p)
			}
		}
		prints = append(prints, printHalveSep)
		for _, r := range t.Backward {
			p := printRecord(r)
			if p != nil {
				prints = append(prints, p)
			}
		}
		prints = append(prints, printNop)
		prints = append(prints, printTripSep)
	}
	Print(prints, false)
}
Exemplo n.º 2
0
func printStats(emits []*dccp.Trace) {
	sort.Sort(TraceTimeSort(emits))
	reducer := dccp_gauge.NewLogReducer()
	for _, rec := range emits {
		reducer.Write(rec)
	}
	trips := dccp_gauge.TripMapToSlice(reducer.Trips())
	sort.Sort(TripSeqNoSort(trips))
	sr, rr := dccp_gauge.CalcRates(trips)
	fmt.Fprintf(os.Stderr, "Send rate: %g pkt/sec, Receive rate: %g pkt/sec\n", sr, rr)
}