Skip to content

Commit

Permalink
Merge pull request #20 from sarchlab/19-dram-latency-is-reported-as-0
Browse files Browse the repository at this point in the history
Fix the bug that DRAM tracer always report 0 as latency
  • Loading branch information
syifan authored Dec 2, 2023
2 parents 37c5609 + 709bae4 commit 384714c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,8 @@
"args": [
"-timing",
"-length=64",
<<<<<<< HEAD
"-report-all",
],
=======
]
>>>>>>> a4c4159dfeef26022d3c97e9ac583fabf5c1d2bd
},
{
"name": "Conv2d",
Expand Down
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 384714c

Please sign in to comment.