From 9525794dc529c66642db8e9bbfe4ea357cdce909 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 10 Apr 2025 23:02:35 +0300 Subject: fixes --- internal/flags/flags.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'internal/flags') diff --git a/internal/flags/flags.go b/internal/flags/flags.go index 120d8fe..36911d8 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -55,6 +55,9 @@ type Flags struct { IorDataFile string CollapsedFields []string CountField string + + // To generate the Flamegraph SVGs + FlamegraphTool string } func Parse() { @@ -78,13 +81,17 @@ func parse() { tracepointsToExclude := flag.String("tpsExclude", "", "Comma separated list regexes for tracepoints to exclude") flag.BoolVar(&singleton.FlamegraphEnable, "flamegraph", false, "Enable flamegraph builder") - flag.StringVar(&singleton.FlamegraphName, "name", "foo", "Name of the flamegraph data output") + flag.StringVar(&singleton.FlamegraphName, "name", "default", "Name of the flamegraph, used to generate the SVG file") flag.StringVar(&singleton.IorDataFile, "ior", "", "IOR data file to convert into collapsed format") fields := flag.String("fields", "", fmt.Sprintf("Comma separated list of fields to collapse, valid are: %v", validCollapsedFields)) flag.StringVar(&singleton.CountField, "count", "count", fmt.Sprintf("Count field to collaps, valid are: %v", validCollapsedCounts)) + + // https://github.com/brendangregg/FlameGraph + flag.StringVar(&singleton.FlamegraphTool, "flamegraphTool", + os.Getenv("HOME")+"/git/FlameGraph/flamegraph.pl", "Path to the flamegraph tool") flag.Parse() singleton.TracepointsToAttach = extractTracepointFlags(*tracepointsToAttach) @@ -102,6 +109,11 @@ func parse() { os.Exit(2) } } + + if !slices.Contains(validCollapsedCounts, singleton.CountField) { + fmt.Println("Invalid count field:", singleton.CountField) + os.Exit(2) + } } func extractTracepointFlags(tracepoints string) (regexes []*regexp.Regexp) { -- cgit v1.2.3