Skip to content

Commit

Permalink
add total measurement instrumentation (imapp-pl#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
pik694 authored and JacekGlen committed May 26, 2022
1 parent 3e0ca9f commit 8a8aed9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ type InstrumenterLogger struct {
StartTime int64

// worker fields, just to avoid reallocation of local vars
OpCodeDuration int64
TimerDuration int64
SinceRuntimeNano int64
Log InstrumenterLog
OpCodeDuration int64
TimerDuration int64
TotalExecutionDuration int64
Log InstrumenterLog
}

// NewInstrumenterLogger returns a new logger
Expand All @@ -59,7 +59,12 @@ func WriteInstrumentation(writer io.Writer, logs []InstrumenterLog) {
}
}

func WriteCSVInstrumentation(writer io.Writer, logs []InstrumenterLog, runId int) {
func WriteCSVInstrumentationTotal(writer io.Writer, instrumenter *InstrumenterLogger, runId int) {
fmt.Fprintf(writer, "%v,%v,%v", runId, instrumenter.TotalExecutionDuration, instrumenter.TimerDuration)
fmt.Fprintln(writer)
}

func WriteCSVInstrumentationAll(writer io.Writer, logs []InstrumenterLog, runId int) {
// CSV header must be in sync with these fields here :(, but it's in measurements.py
for instructionId, log := range logs {
fmt.Fprintf(writer, "%v,%v,%v,%v", runId, instructionId, log.TimeNs, log.TimerTimeNs)
Expand Down

0 comments on commit 8a8aed9

Please sign in to comment.