Skip to content

Commit

Permalink
no need pointer on map
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylphrex committed Dec 6, 2024
1 parent 305c63b commit 13f6269
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/chunk/sample_readjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type (

CallTreesReadJobResult struct {
Err error
CallTrees *map[string][]*nodetree.Node
CallTrees map[string][]*nodetree.Node
Chunk *SampleChunk
TransactionID string
ThreadID *string
Expand All @@ -89,7 +89,7 @@ func (job CallTreesReadJob) Read() {

job.Result <- CallTreesReadJobResult{
Err: err,
CallTrees: &callTrees,
CallTrees: callTrees,
Chunk: &chunk,
TransactionID: job.TransactionID,
ThreadID: job.ThreadID,
Expand Down
6 changes: 3 additions & 3 deletions internal/flamegraph/flamegraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,13 @@ func GetFlamegraphFromCandidates(
example := utils.NewExampleFromProfileID(result.Profile.ProjectID(), result.Profile.ID())
annotate := annotateWithProfileExample(example)

for _, callTree := range *result.CallTrees {
for _, callTree := range result.CallTrees {
addCallTreeToFlamegraph(&flamegraphTree, callTree, annotate)
}
// if metrics aggregator is not null, while we're at it,
// compute the metrics as well
if ma != nil {
functions := metrics.CapAndFilterFunctions(metrics.ExtractFunctionsFromCallTrees(*result.CallTrees), int(ma.MaxUniqueFunctions), true)
functions := metrics.CapAndFilterFunctions(metrics.ExtractFunctionsFromCallTrees(result.CallTrees), int(ma.MaxUniqueFunctions), true)
ma.AddFunctions(functions, example)
}

Expand All @@ -466,7 +466,7 @@ func GetFlamegraphFromCandidates(
chunkProfileSpan := span.StartChild("calltree")
chunkProfileSpan.Description = "continuous profile"

for threadID, callTree := range *result.CallTrees {
for threadID, callTree := range result.CallTrees {
if result.Start > 0 && result.End > 0 {
interval := utils.Interval{
Start: result.Start,
Expand Down
4 changes: 2 additions & 2 deletions internal/profile/readjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type (

CallTreesReadJobResult struct {
Err error
CallTrees *map[uint64][]*nodetree.Node
CallTrees map[uint64][]*nodetree.Node
Profile *Profile
}
)
Expand All @@ -69,7 +69,7 @@ func (job CallTreesReadJob) Read() {
callTrees, err := profile.CallTrees()

job.Result <- CallTreesReadJobResult{
CallTrees: &callTrees,
CallTrees: callTrees,
Profile: &profile,
Err: err,
}
Expand Down

0 comments on commit 13f6269

Please sign in to comment.