Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
### New features
- Add a new tool: A debug tool for Trace Profiling is provided for developers to troubleshoot problems.([#363](https://github.com/CloudDectective-Harmonycloud/kindling/pull/363))

### Bug fixes
- Fix the bug of incomplete records when threads arrive at the cpu analyzer for the first time. ([#364](https://github.com/CloudDectective-Harmonycloud/kindling/pull/364))

## v0.5.0 - 2022-11-02
### New features
- Add a new feature: Trace Profiling. See more details about it on our [website](http://kindling.harmonycloud.cn). ([#335](https://github.com/CloudDectective-Harmonycloud/kindling/pull/335))
Expand Down
18 changes: 13 additions & 5 deletions collector/pkg/component/analyzer/cpuanalyzer/cpu_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package cpuanalyzer

import (
"fmt"
"strconv"
"sync"

"github.com/Kindling-project/kindling/collector/pkg/component"
"github.com/Kindling-project/kindling/collector/pkg/component/analyzer"
"github.com/Kindling-project/kindling/collector/pkg/component/consumer"
"github.com/Kindling-project/kindling/collector/pkg/model"
"github.com/Kindling-project/kindling/collector/pkg/model/constnames"
"go.uber.org/zap/zapcore"
"strconv"
"sync"
)

const (
Expand Down Expand Up @@ -221,9 +222,16 @@ func (ca *CpuAnalyzer) PutEventToSegments(pid uint32, tid uint32, threadName str
(newTimeSegments.BaseTime+uint64(i+1))*nanoToSeconds)
newTimeSegments.Segments.UpdateByIndex(i, segment)
}
val := newTimeSegments.Segments.GetByIndex(0)
segment := val.(*Segment)
segment.putTimedEvent(event)

endOffset := int(event.EndTimestamp()/nanoToSeconds - newTimeSegments.BaseTime)

for i := 0; i <= endOffset && i < maxSegmentSize; i++ {
val := newTimeSegments.Segments.GetByIndex(i)
segment := val.(*Segment)
segment.putTimedEvent(event)
segment.IsSend = 0
}

tidCpuEvents[tid] = newTimeSegments
}
}
Expand Down