Skip to content

Commit

Permalink
Removed the ts hasher as that is unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
manojVivek committed Jan 2, 2025
1 parent ec64dfa commit 5924c82
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 1 addition & 7 deletions pkg/query/flamegraph_arrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ func generateFlamegraphArrowRecord(ctx context.Context, mem memory.Allocator, tr

profileReader := profile.NewReader(p)
labelHasher := xxh3.New()
tsHasher := xxh3.New()
for _, r := range profileReader.RecordReaders {
fb.cumulative += math.Int64.Sum(r.Value)
fb.diff += math.Int64.Sum(r.Diff)
Expand Down Expand Up @@ -199,12 +198,7 @@ func generateFlamegraphArrowRecord(ctx context.Context, mem memory.Allocator, tr
row = fb.builderCumulative.Len()
}
if fb.aggregationConfig.aggregateByTimestamp {
tsHasher.Reset()
tsStr := strconv.FormatInt(r.Timestamp.Value(i), 10)
durationStr := strconv.FormatInt(r.Duration.Value(i), 10)
_, _ = tsHasher.Write([]byte(tsStr))
_, _ = tsHasher.Write([]byte(durationStr))
tsHash = tsHasher.Sum64()
tsHash = uint64(r.Timestamp.Value(i))

sampleTsRow := row
if _, ok := fb.rootsRow[tsHash]; ok {
Expand Down
4 changes: 1 addition & 3 deletions pkg/query/flamegraph_arrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1220,8 +1220,6 @@ func TestFlamechartGroupByTimestamp(t *testing.T) {
main;func_fib 10 1000 20
runtime;gc 10 2000 20
main;func_fib 10 3000 20
runtime;gc 20 2000 30
runtime;gc 20 3000 30
`))
require.NoError(t, err)
defer func() {
Expand Down Expand Up @@ -1276,7 +1274,7 @@ runtime;gc 20 3000 30
rootNodesMetadata = append(rootNodesMetadata, metadata{ts: ts, duration: duration})
}

require.Equal(t, []metadata{{1000, 20}, {2000, 20}, {3000, 20}, {2000, 30}, {3000, 30}}, rootNodesMetadata)
require.Equal(t, []metadata{{1000, 20}, {2000, 20}, {3000, 20}}, rootNodesMetadata)
}

// split the line into 4 parts: stack, value, timestamp, duration
Expand Down

0 comments on commit 5924c82

Please sign in to comment.