Skip to content

Commit

Permalink
Added streaming statistics.
Browse files Browse the repository at this point in the history
  • Loading branch information
markkurossi committed Aug 5, 2023
1 parent f5ea680 commit 8a38142
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 10 additions & 3 deletions circuit/timing.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,17 @@ func (t *Timing) Print(stats p2p.IOStats) {
row.Column(col)
}

for _, sub := range sample.Samples {
for idx, sub := range sample.Samples {
row := tab.Row()
row.Column("\u2570\u2574" + sub.Label).SetFormat(tabulate.FmtItalic)

var prefix string
if idx+1 >= len(sample.Samples) {
prefix = "\u2570\u2574"
} else {
prefix = "\u251C\u2574"
}

row.Column(prefix + sub.Label).SetFormat(tabulate.FmtItalic)

var d time.Duration
if sub.Abs > 0 {
Expand All @@ -89,7 +97,6 @@ func (t *Timing) Print(stats p2p.IOStats) {
row.Column(
fmt.Sprintf("%.2f%%", float64(d)/float64(duration)*100)).
SetFormat(tabulate.FmtItalic)

}
}
row := tab.Row()
Expand Down
13 changes: 12 additions & 1 deletion compiler/ssa/streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (prog *Program) StreamCircuit(conn *p2p.Conn, oti ot.OT,

start := time.Now()
lastReport := start
var circCompileDuration time.Duration

istats := make(map[string]circuit.Stats)

Expand Down Expand Up @@ -433,6 +434,7 @@ func (prog *Program) StreamCircuit(conn *p2p.Conn, oti ot.OT,
if !ok {
var cIn [][]*circuits.Wire
var flat []*circuits.Wire
startTime := time.Now()

for _, in := range wires {
w := circuits.MakeWires(types.Size(len(in)))
Expand Down Expand Up @@ -467,6 +469,7 @@ func (prog *Program) StreamCircuit(conn *p2p.Conn, oti ot.OT,
fmt.Printf("%05d: - %s\n", idx, circ)
}
circ.AssignLevels()
circCompileDuration += time.Now().Sub(startTime)
}
if false {
circ.Dump()
Expand Down Expand Up @@ -497,7 +500,15 @@ func (prog *Program) StreamCircuit(conn *p2p.Conn, oti ot.OT,

xfer = conn.Stats.Sum() - ioStats
ioStats = conn.Stats.Sum()
timing.Sample("Garble", []string{circuit.FileSize(xfer).String()})
sample := timing.Sample("Stream", []string{circuit.FileSize(xfer).String()})
sample.Samples = append(sample.Samples, &circuit.Sample{
Label: "Compile",
Abs: circCompileDuration,
})
sample.Samples = append(sample.Samples, &circuit.Sample{
Label: "Garble",
Abs: prog.garbleDuration,
})

result := new(big.Int)

Expand Down

0 comments on commit 8a38142

Please sign in to comment.