From 5924c82b28fb820662a060e9eec5e1563fedab9c Mon Sep 17 00:00:00 2001
From: Manoj Vivek
Date: Thu, 2 Jan 2025 16:55:45 +0530
Subject: [PATCH] Removed the ts hasher as that is unnecessary
---
pkg/query/flamegraph_arrow.go | 8 +-------
pkg/query/flamegraph_arrow_test.go | 4 +---
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/pkg/query/flamegraph_arrow.go b/pkg/query/flamegraph_arrow.go
index d38d21e1cb0..2cea4726f6d 100644
--- a/pkg/query/flamegraph_arrow.go
+++ b/pkg/query/flamegraph_arrow.go
@@ -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)
@@ -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 {
diff --git a/pkg/query/flamegraph_arrow_test.go b/pkg/query/flamegraph_arrow_test.go
index 3a27b93863f..4b30997774a 100644
--- a/pkg/query/flamegraph_arrow_test.go
+++ b/pkg/query/flamegraph_arrow_test.go
@@ -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() {
@@ -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