From dd73ed4678a3623f1c71ceb88aec481de5b9d64e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 11 Apr 2025 22:26:00 +0300 Subject: jo --- internal/flamegraph/collapsed.go | 12 +++++++++--- internal/flamegraph/iordata.go | 4 +++- internal/flamegraph/tool.go | 9 ++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'internal/flamegraph') diff --git a/internal/flamegraph/collapsed.go b/internal/flamegraph/collapsed.go index 68090b8..d3a690a 100644 --- a/internal/flamegraph/collapsed.go +++ b/internal/flamegraph/collapsed.go @@ -8,10 +8,16 @@ import ( "github.com/DataDog/zstd" ) +// Collapsed represents a structure used to process and store information +// related to a collapsed flamegraph. It includes the following fields: +// - iorFile: The path to the input/output report file. +// - fields: A list of field names used in the flamegraph processing. +// - countField: The name of the field that represents the count or weight +// in the flamegraph data. type Collapsed struct { - iorFile string - fields []string - countField string + iorFile string // Path to the input/output report file. + fields []string // List of field names used in processing. + countField string // Field name representing the count or weight. } func NewCollapsed(iorFile string, fields []string, countField string) Collapsed { diff --git a/internal/flamegraph/iordata.go b/internal/flamegraph/iordata.go index cef01ff..1c2b0f4 100644 --- a/internal/flamegraph/iordata.go +++ b/internal/flamegraph/iordata.go @@ -26,8 +26,10 @@ type tidType = uint32 type flagsType = file.Flags type pathMap map[pathType]map[traceIdType]map[commType]map[pidType]map[tidType]map[flagsType]Counter +// iorData is a structure that holds data related to I/O operations. +// It contains a map of paths, which is used to manage and store path-related information. type iorData struct { - paths pathMap // Make sure this field is accessible from outside + paths pathMap // paths is a map that stores path-related data. Note: This field is currently unexported. } func newIorData() iorData { diff --git a/internal/flamegraph/tool.go b/internal/flamegraph/tool.go index 6840e35..0ce33e3 100644 --- a/internal/flamegraph/tool.go +++ b/internal/flamegraph/tool.go @@ -11,10 +11,13 @@ import ( "github.com/DataDog/zstd" ) +// Tool represents a utility for generating flamegraphs. +// It contains the path to the flamegraph tool, the arguments to be passed to it, +// and the output file where the generated flamegraph will be stored. type Tool struct { - flamegraphTool string - args []string - outFile string + flamegraphTool string // Path to the flamegraph tool executable. + args []string // Arguments to be passed to the flamegraph tool. + outFile string // Path to the output file where the flamegraph will be saved. } func NewTool(collapsedFile string) (Tool, error) { -- cgit v1.2.3