summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/treemap.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-18 20:54:35 +0200
committerPaul Buetow <paul@buetow.org>2026-03-18 20:54:35 +0200
commitcd554b0af706b5f62b4e1bfde04091052b4aac61 (patch)
treee6d02f1c2a1da27da17386e8832c2d4a3e699cdf /internal/tui/dashboard/treemap.go
parentb421b2232351049277ee4ad5b31367bb2b6779bb (diff)
cleanup
Diffstat (limited to 'internal/tui/dashboard/treemap.go')
-rw-r--r--internal/tui/dashboard/treemap.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/internal/tui/dashboard/treemap.go b/internal/tui/dashboard/treemap.go
index 7193952..dd62d13 100644
--- a/internal/tui/dashboard/treemap.go
+++ b/internal/tui/dashboard/treemap.go
@@ -1,10 +1,11 @@
package dashboard
import (
+ "cmp"
"fmt"
"image/color"
"math"
- "sort"
+ "slices"
"strings"
"unicode/utf8"
@@ -131,11 +132,11 @@ func buildSyscallTreemapItems(snap *statsengine.Snapshot, metric bubbleMetric) [
if len(items) == 0 {
return nil
}
- sort.Slice(items, func(i, j int) bool {
- if items[i].Value != items[j].Value {
- return items[i].Value > items[j].Value
+ slices.SortFunc(items, func(a, b syscallTreemapItem) int {
+ if a.Value != b.Value {
+ return cmp.Compare(b.Value, a.Value)
}
- return items[i].Name < items[j].Name
+ return cmp.Compare(a.Name, b.Name)
})
if len(items) > maxSyscallTreemapItems {
items = items[:maxSyscallTreemapItems]
@@ -174,11 +175,11 @@ func buildFilesTreemapItems(snap *statsengine.Snapshot, metric bubbleMetric) []s
if len(items) == 0 {
return nil
}
- sort.Slice(items, func(i, j int) bool {
- if items[i].Value != items[j].Value {
- return items[i].Value > items[j].Value
+ slices.SortFunc(items, func(a, b syscallTreemapItem) int {
+ if a.Value != b.Value {
+ return cmp.Compare(b.Value, a.Value)
}
- return items[i].Name < items[j].Name
+ return cmp.Compare(a.Name, b.Name)
})
if len(items) > maxSyscallTreemapItems {
items = items[:maxSyscallTreemapItems]
@@ -217,11 +218,11 @@ func buildProcessesTreemapItems(snap *statsengine.Snapshot, metric bubbleMetric)
if len(items) == 0 {
return nil
}
- sort.Slice(items, func(i, j int) bool {
- if items[i].Value != items[j].Value {
- return items[i].Value > items[j].Value
+ slices.SortFunc(items, func(a, b syscallTreemapItem) int {
+ if a.Value != b.Value {
+ return cmp.Compare(b.Value, a.Value)
}
- return items[i].Name < items[j].Name
+ return cmp.Compare(a.Name, b.Name)
})
if len(items) > maxSyscallTreemapItems {
items = items[:maxSyscallTreemapItems]