Skip to content

Commit

Permalink
Merge branch 'v3' into rdma_tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
syifan authored Dec 2, 2023
2 parents b0b3b74 + 384714c commit 0bbfbc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion samples/runner/dramtracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// dramTracer can trace DRAM activities.
type dramTracer struct {
sync.Mutex
sim.TimeTeller

inflightTasks map[string]tracing.Task

Expand All @@ -22,8 +23,9 @@ type dramTracer struct {
writeSize uint64
}

func newDramTracer() *dramTracer {
func newDramTracer(timeTeller sim.TimeTeller) *dramTracer {
return &dramTracer{
TimeTeller: timeTeller,
inflightTasks: make(map[string]tracing.Task),
}
}
Expand All @@ -33,6 +35,8 @@ func (t *dramTracer) StartTask(task tracing.Task) {
t.Lock()
defer t.Unlock()

task.StartTime = t.TimeTeller.CurrentTime()

t.inflightTasks[task.ID] = task
}

Expand All @@ -51,6 +55,7 @@ func (t *dramTracer) EndTask(task tracing.Task) {
return
}

task.EndTime = t.TimeTeller.CurrentTime()
taskTime := task.EndTime - originalTask.StartTime

switch originalTask.What {
Expand Down
2 changes: 1 addition & 1 deletion samples/runner/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func (r *Runner) addDRAMTracer() {
for _, dram := range gpu.MemControllers {
t := dramTransactionCountTracer{}
t.dram = dram.(TraceableComponent)
t.tracer = newDramTracer()
t.tracer = newDramTracer(r.platform.Engine)

tracing.CollectTrace(t.dram, t.tracer)

Expand Down

0 comments on commit 0bbfbc5

Please sign in to comment.