summaryrefslogtreecommitdiff
path: root/internal/collapse/fields.go
blob: b87fe1136cb9f9ef5061e59e54cb94bd49b02512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package collapse

import "slices"

var validFields = []string{
	"path",
	"comm",
	"tracepoint",
	"pid",
	"tid",
	"flags",
}

var validCountFields = []string{
	"count",
	"duration",
	"durationToPrev",
	"bytes",
}

// ValidFields returns a copy of supported collapse fields.
func ValidFields() []string {
	return slices.Clone(validFields)
}

// ValidCountFields returns a copy of supported collapse count fields.
func ValidCountFields() []string {
	return slices.Clone(validCountFields)
}

// IsValidField reports whether a collapse field is supported.
func IsValidField(field string) bool {
	return slices.Contains(validFields, field)
}

// IsValidCountField reports whether a collapse count field is supported.
func IsValidCountField(field string) bool {
	return slices.Contains(validCountFields, field)
}