Skip to content

Commit

Permalink
task_id added
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanhuanO committed Oct 13, 2024
1 parent 1747864 commit d766b85
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions timing/rob/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Builder struct {
freq sim.Freq
numReqPerCycle int
bufferSize int
bottomUnit sim.Port
bottomUnit sim.Port
}

// MakeBuilder creates a builder with default parameters.
Expand Down Expand Up @@ -56,7 +56,7 @@ func (b Builder) Build(name string) *ReorderBuffer {
rb.transactions = list.New()
rb.transactions.Init()
rb.toBottomReqIDToTransactionTable = make(map[string]*list.Element)

rb.BottomUnit = b.bottomUnit
rb.bufferSize = b.bufferSize
rb.numReqPerCycle = b.numReqPerCycle

Expand Down
32 changes: 22 additions & 10 deletions timing/rob/rob.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package rob
import (
"container/list"
"github.com/sarchlab/akita/v3/mem/mem"
// "github.com/sarchlab/akita/v3/mem/cache"
"github.com/sarchlab/akita/v3/sim"
"github.com/sarchlab/akita/v3/tracing"
"fmt"
"encoding/csv"
"sync"
"os"
)

Expand Down Expand Up @@ -52,8 +52,6 @@ func (m *MilestoneManager) AddMilestone(
blockingLocation string,
timestamp sim.VTimeInSec,
) {
m.mutex.Lock()
defer m.mutex.Unlock()
milestone := Milestone {
ID: fmt.Sprintf("milestone_%d", len(m.milestones)+1),
TaskID: taskID,
Expand All @@ -68,24 +66,30 @@ func (m *MilestoneManager) AddMilestone(

type MilestoneManager struct {
milestones []Milestone
mutex sync.Mutex
}

var GlobalMilestoneManager = &MilestoneManager{
milestones: make([]Milestone, 0),
}

func (m *MilestoneManager) GetMilestones() []Milestone {
m.mutex.Lock()
defer m.mutex.Unlock()

return m.milestones
}

func (b *ReorderBuffer) getTaskID() string {
if b.transactions.Len() > 0 {
trans := b.transactions.Front().Value.(*transaction)
return tracing.MsgIDAtReceiver(trans.reqFromTop, b)
}
return ""
}

// func (b *ReorderBuffer) canCacheAcceptRequest() bool {
// if *cache != nil {
// return !*cache.isFull()
// }
// return true
// }

// Tick updates the status of the ReorderBuffer.
func (b *ReorderBuffer) Tick(now sim.VTimeInSec) (madeProgress bool) {
Expand Down Expand Up @@ -203,6 +207,17 @@ func (b *ReorderBuffer) topDown(now sim.VTimeInSec) bool {
return false
}

// if !b.canCacheAcceptRequest() {
// GlobalMilestoneManager.AddMilestone(
// b.getTaskID(),
// "Hardware Occupancy",
// "Cache full",
// "topDown",
// now,
// )
// return false
// }

item := b.topPort.Peek()
if item == nil {
return false
Expand Down Expand Up @@ -400,9 +415,6 @@ func (b *ReorderBuffer) duplicateWriteDoneRsp(
}

func (m *MilestoneManager) ExportMilestonesToCSV(filename string) error {
m.mutex.Lock()
defer m.mutex.Unlock()

for _, milestone := range m.milestones {
fmt.Printf("ID: %s, TaskID: %s, BlockingCategory: %s, BlockingReason: %s, BlockingLocation: %s, Timestamp: %v\n",
milestone.ID, milestone.TaskID, milestone.BlockingCategory, milestone.BlockingReason, milestone.BlockingLocation, milestone.Timestamp)
Expand Down

0 comments on commit d766b85

Please sign in to comment.