Skip to content

Commit

Permalink
adjust code style
Browse files Browse the repository at this point in the history
Signed-off-by: yaofighting <[email protected]>
  • Loading branch information
yaofighting committed Nov 23, 2022
1 parent 2fb0620 commit f1cc70a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 5 additions & 1 deletion collector/pkg/component/analyzer/cpuanalyzer/cpu_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (ca *CpuAnalyzer) ConsumableEvents() []string {
return []string{constnames.CpuEvent, constnames.JavaFutexInfo, constnames.TransactionIdEvent, constnames.ProcessExitEvent}
}

func NewTidDeleteQueue() *tidDeleteQueue {
return &tidDeleteQueue{queue: make([]deleteTid, 0)}
}

func NewCpuAnalyzer(cfg interface{}, telemetry *component.TelemetryTools, consumers []consumer.Consumer) analyzer.Analyzer {
config, _ := cfg.(*Config)
ca := &CpuAnalyzer{
Expand All @@ -45,7 +49,7 @@ func NewCpuAnalyzer(cfg interface{}, telemetry *component.TelemetryTools, consum
nextConsumers: consumers,
}
ca.cpuPidEvents = make(map[uint32]map[uint32]*TimeSegments, 100000)
ca.InitTidDeleteQueue()
ca.tidExpiredQueue = NewTidDeleteQueue()
go ca.TidDelete(20*time.Second, 10*time.Second)
return ca
}
Expand Down
6 changes: 1 addition & 5 deletions collector/pkg/component/analyzer/cpuanalyzer/delete_tid.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ func (dq *tidDeleteQueue) Pop() {
}
}

func (ca *CpuAnalyzer) InitTidDeleteQueue() {
ca.tidExpiredQueue = &tidDeleteQueue{queue: make([]deleteTid, 0)}
}

//Add procexit tid
func (ca *CpuAnalyzer) AddTidToDeleteCache(curTime time.Time, pid uint32, tid uint32) {
defer ca.tidExpiredQueue.queueMutex.Unlock()
cacheElem := deleteTid{pid: pid, tid: tid, exitTime: curTime}
ca.tidExpiredQueue.queueMutex.Lock()
defer ca.tidExpiredQueue.queueMutex.Unlock()
ca.tidExpiredQueue.Push(cacheElem)
}

Expand Down

0 comments on commit f1cc70a

Please sign in to comment.