github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/storage/heatmap/heatmap.go (about)

     1  package heatmap
     2  
     3  import "time"
     4  
     5  type Heatmap struct {
     6  	// Values matrix contain values that indicate count of value occurrences,
     7  	// satisfying boundaries of the X and Y bins: [StartTime:EndTime) and (MinValue:MaxValue].
     8  	// A value can be accessed via Values[x][y], where:
     9  	//   0 <= x < TimeBuckets, and
    10  	//   0 <= y < ValueBuckets.
    11  	Values [][]uint64
    12  	// TimeBuckets denotes number of ticks on the X-axis.
    13  	TimeBuckets int64
    14  	// ValueBuckets denotes number of ticks on the Y-axis.
    15  	ValueBuckets int64
    16  	// StartTime and EndTime indicate boundaries of the X axis.
    17  	StartTime time.Time
    18  	EndTime   time.Time
    19  	// MinValue and MaxValue indicate boundaries of the Y axis.
    20  	MinValue uint64
    21  	MaxValue uint64
    22  	// MinDepth and MaxDepth indicate boundaries of the Z axis: [MinDepth:MaxDepth].
    23  	// MinDepth is the minimal non-zero value (count of value occurrences) that can
    24  	// be found in Values.
    25  	MinDepth uint64
    26  	MaxDepth uint64
    27  }
    28  
    29  type HeatmapParams struct {
    30  	// TimeBuckets denotes number of ticks on the X-axis.
    31  	TimeBuckets int64
    32  	// ValueBuckets denotes number of ticks on the Y-axis.
    33  	ValueBuckets int64
    34  	// StartTime and EndTime indicate boundaries of the X axis.
    35  	StartTime time.Time
    36  	EndTime   time.Time
    37  	MinValue  uint64
    38  	MaxValue  uint64
    39  }
    40  
    41  type HeatmapSketch struct {
    42  	HeatmapParams
    43  	Columns []HeatmapColumn
    44  }
    45  
    46  type HeatmapColumn struct {
    47  	Values []uint64
    48  	Counts []uint64
    49  }