Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cmd/dccp-inspector/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type emitSubPipe struct {
}

type logPipe struct {
Log *dccp.LogRecord
Log *dccp.Trace
Pipe *emitPipe
}

Expand Down Expand Up @@ -87,7 +87,7 @@ func htmlize(records []*logPipe, srt bool, includeEmits bool) {

// pipeEmit converts a log record into an HTMLRecord.
// The Time field of the
func pipeEmit(t *dccp.LogRecord) *logPipe {
func pipeEmit(t *dccp.Trace) *logPipe {
var pipe *emitPipe
switch t.Event {
case dccp.EventWrite:
Expand Down Expand Up @@ -149,7 +149,7 @@ func htmlizePipe(e *emitPipe) string {

const htmlPacketWidth = 21

func pipeWrite(r *dccp.LogRecord) *emitPipe {
func pipeWrite(r *dccp.Trace) *emitPipe {
switch r.Labels[0] {
case "server":
return &emitPipe{
Expand Down Expand Up @@ -184,7 +184,7 @@ func pipeWrite(r *dccp.LogRecord) *emitPipe {
return nil
}

func pipeRead(r *dccp.LogRecord) *emitPipe {
func pipeRead(r *dccp.Trace) *emitPipe {
switch r.Labels[0] {
case "client":
return &emitPipe{
Expand Down Expand Up @@ -219,7 +219,7 @@ func pipeRead(r *dccp.LogRecord) *emitPipe {
return nil
}

func pipeIdle(r *dccp.LogRecord) *emitPipe {
func pipeIdle(r *dccp.Trace) *emitPipe {
switch r.Labels[0] {
case "client":
return &emitPipe{
Expand All @@ -239,7 +239,7 @@ func pipeIdle(r *dccp.LogRecord) *emitPipe {
return nil
}

func pipeDrop(r *dccp.LogRecord) *emitPipe {
func pipeDrop(r *dccp.Trace) *emitPipe {
switch r.Labels[0] {
case "line":
switch r.Labels[1] {
Expand Down Expand Up @@ -314,14 +314,14 @@ func pipeDrop(r *dccp.LogRecord) *emitPipe {

const htmlEventWidth = 41

func sprintPacketEventCommentHTML(r *dccp.LogRecord) string {
func sprintPacketEventCommentHTML(r *dccp.Trace) string {
if r.Type == "" {
return fmt.Sprintf(" %s ", cut(r.Comment, htmlEventWidth-4))
}
return fmt.Sprintf(" ¶ %s ", cut(r.Comment, htmlEventWidth-4))
}

func pipeGeneric(r *dccp.LogRecord) *emitPipe {
func pipeGeneric(r *dccp.Trace) *emitPipe {
switch r.Labels[0] {
case "line":
return &emitPipe{
Expand Down
22 changes: 11 additions & 11 deletions cmd/dccp-inspector/inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func main() {
logDec := json.NewDecoder(logFile)

// Raw log entries will go into emits
var emits []*dccp.LogRecord = make([]*dccp.LogRecord, 0)
var emits []*dccp.Trace = make([]*dccp.Trace, 0)
for {
rec := &dccp.LogRecord{}
rec := &dccp.Trace{}
if err = logDec.Decode(rec); err != nil {
break
}
Expand All @@ -70,8 +70,8 @@ func main() {
printStats(emits)
}

func printStats(emits []*dccp.LogRecord) {
sort.Sort(LogRecordTimeSort(emits))
func printStats(emits []*dccp.Trace) {
sort.Sort(TraceTimeSort(emits))
reducer := dccp_gauge.NewLogReducer()
for _, rec := range emits {
reducer.Write(rec)
Expand All @@ -82,23 +82,23 @@ func printStats(emits []*dccp.LogRecord) {
fmt.Fprintf(os.Stderr, "Send rate: %g pkt/sec, Receive rate: %g pkt/sec\n", sr, rr)
}

// LogRecordTimeSort sorts LogRecord records by timestamp
type LogRecordTimeSort []*dccp.LogRecord
// TraceTimeSort sorts Trace records by timestamp
type TraceTimeSort []*dccp.Trace

func (t LogRecordTimeSort) Len() int {
func (t TraceTimeSort) Len() int {
return len(t)
}

func (t LogRecordTimeSort) Less(i, j int) bool {
func (t TraceTimeSort) Less(i, j int) bool {
return t[i].Time < t[j].Time
}

func (t LogRecordTimeSort) Swap(i, j int) {
func (t TraceTimeSort) Swap(i, j int) {
t[i], t[j] = t[j], t[i]
}

// TODO: Not used any more; Remove
func printBasic(emits []*dccp.LogRecord) {
func printBasic(emits []*dccp.Trace) {
prints := make([]*PrintRecord, 0)
for _, t := range emits {
var p *PrintRecord = printRecord(t)
Expand All @@ -109,7 +109,7 @@ func printBasic(emits []*dccp.LogRecord) {
Print(prints, true)
}

func htmlBasic(emits []*dccp.LogRecord, includeEmits bool) {
func htmlBasic(emits []*dccp.Trace, includeEmits bool) {
lps := make([]*logPipe, 0)
for _, t := range emits {
p := pipeEmit(t)
Expand Down
24 changes: 12 additions & 12 deletions cmd/dccp-inspector/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
)

type PrintRecord struct {
Log *dccp.LogRecord
Log *dccp.Trace
Text string
}

// printRecord converts a log record into a PrintRecord
func printRecord(t *dccp.LogRecord) *PrintRecord {
func printRecord(t *dccp.Trace) *PrintRecord {
switch t.Event {
case dccp.EventWrite:
return printWrite(t)
Expand All @@ -36,7 +36,7 @@ const (
skipState = " "
)

func printWrite(r *dccp.LogRecord) *PrintRecord {
func printWrite(r *dccp.Trace) *PrintRecord {
switch r.Labels[0] {
case "server":
return &PrintRecord{
Expand All @@ -54,7 +54,7 @@ func printWrite(r *dccp.LogRecord) *PrintRecord {
return nil
}

func printRead(r *dccp.LogRecord) *PrintRecord {
func printRead(r *dccp.Trace) *PrintRecord {
switch r.Labels[0] {
case "client":
return &PrintRecord{
Expand All @@ -72,7 +72,7 @@ func printRead(r *dccp.LogRecord) *PrintRecord {
return nil
}

func printDrop(r *dccp.LogRecord) *PrintRecord {
func printDrop(r *dccp.Trace) *PrintRecord {
var text string
switch r.Labels[0] {
// XXX: Seems there is a bug in the print out formats below (the server case format feels like it should be the line case)
Expand Down Expand Up @@ -113,7 +113,7 @@ func printDrop(r *dccp.LogRecord) *PrintRecord {
}
}

func printIdle(r *dccp.LogRecord) *PrintRecord {
func printIdle(r *dccp.Trace) *PrintRecord {
var text string
switch r.Labels[0] {
case "client":
Expand All @@ -132,7 +132,7 @@ func printIdle(r *dccp.LogRecord) *PrintRecord {
}
}

func printGeneric(r *dccp.LogRecord) *PrintRecord {
func printGeneric(r *dccp.Trace) *PrintRecord {
var text string
switch r.Labels[0] {
case "client":
Expand All @@ -154,22 +154,22 @@ func printGeneric(r *dccp.LogRecord) *PrintRecord {
}
}

func sprintIdle(r *dccp.LogRecord) string {
func sprintIdle(r *dccp.Trace) string {
return "————————————————————————————————"
}

func sprintPacket(r *dccp.LogRecord) string {
func sprintPacket(r *dccp.Trace) string {
return sprintPacketWidth(r, 9)
}

func sprintPacketWide(r *dccp.LogRecord) string {
func sprintPacketWide(r *dccp.Trace) string {
if r.Type == "" {
return ""
}
return fmt.Sprintf("Type=%s SeqNo=%06x AckNo=%06x", r.Type, r.SeqNo, r.AckNo)
}

func sprintPacketWidth(r *dccp.LogRecord, width int) string {
func sprintPacketWidth(r *dccp.Trace, width int) string {
var w bytes.Buffer
w.WriteString(r.Type)
for i := 0; i < width-len(r.Type); i++ {
Expand All @@ -178,7 +178,7 @@ func sprintPacketWidth(r *dccp.LogRecord, width int) string {
return fmt.Sprintf(" %s%06x·%06x ", string(w.Bytes()), r.SeqNo, r.AckNo)
}

func sprintPacketEventComment(r *dccp.LogRecord) string {
func sprintPacketEventComment(r *dccp.Trace) string {
if r.SeqNo == 0 {
return fmt.Sprintf(" %-22s ", cut(r.Comment, 22))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/dccp-inspector/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (x *SeriesSweeper) Init() {

// Add adds a new log record to the series. It assumes that records are added
// in increasing chronological order
func (x *SeriesSweeper) Add(r *dccp.LogRecord) {
func (x *SeriesSweeper) Add(r *dccp.Trace) {
if !r.IsHighlighted() {
return
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/dccp-inspector/trip.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
printNop = &PrintRecord{}
)

func printTrip(emits []*dccp.LogRecord) {
func printTrip(emits []*dccp.Trace) {
reducer := dccp_gauge.NewLogReducer()
for _, rec := range emits {
reducer.Write(rec)
Expand Down
88 changes: 0 additions & 88 deletions dccp/addr.go

This file was deleted.

5 changes: 0 additions & 5 deletions dccp/amb.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package dccp

import (
"reflect"
"github.com/petar/GoGauge/filter"
)

// Amb represents a runtime context, embodied by a runtime, a stack of labels
Expand Down Expand Up @@ -67,10 +66,6 @@ func (t *Amb) Push(l string) *Amb {
return t
}

func (t *Amb) Filter() *filter.Filter {
return t.env.Filter()
}

// GetState retrieves the state of the owning object, using the runtime value store
func (t *Amb) GetState() string {
if t.env == nil || len(t.labels) == 0 {
Expand Down
4 changes: 2 additions & 2 deletions dccp/ccfixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ type CCFixed struct {

}

func (CCFixed) NewSender(env *Env, amb *Amb) SenderCongestionControl {
func (CCFixed) NewSender(env *Env, amb *Amb, args ...interface{}) SenderCongestionControl {
return newFixedRateSenderControl(env, 1e9) // one packet per second. sendsPerSecond
}

func (CCFixed) NewReceiver(env *Env, amb *Amb) ReceiverCongestionControl {
func (CCFixed) NewReceiver(env *Env, amb *Amb, args ...interface{}) ReceiverCongestionControl {
return newFixedRateReceiverControl(env)
}

Expand Down
9 changes: 4 additions & 5 deletions dccp/connect_test.go.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ func TestConnect(t *testing.T) {

// Install stacks
linka, linkb := NewChanPipe()
newscc := NewFixedRateSenderControlFunc(10)
newrcc := NewFixedRateReceiverControlFunc()
stacka, stackb := NewStack(linka, newscc, newrcc), NewStack(linkb, newscc, newrcc)
var ccid CCID = &CCFixed{}
stacka, stackb := NewStack(linka, ccid), NewStack(linkb, ccid)

// Establish connection
ca, err := stacka.Dial(nil, 1)
Expand All @@ -34,11 +33,11 @@ func TestConnect(t *testing.T) {
}

// Write and read the block
err = ca.WriteSegment(p)
err = ca.Write(p)
if err != nil {
t.Errorf("side a write: %s", err)
}
q, err := cb.ReadSegment()
q, err := cb.Read()
if err != nil {
t.Errorf("side b read: %s", err)
}
Expand Down
Loading