in src/graphing/heatmap.py [0:0]
def get_heatmap_data_logarithmic(timestamp_groups, datapoint_groups, labels, dimensions):
x_bucket_count = dimensions[0] # Number of time intervals to group gc events into. INT ONLY
y_bucket_count = dimensions[1] # Number of latency time intervals to group events into. INT ONLY
x_bucket_duration = dimensions[2] # Duration in seconds that each time interval bucket has for gc event timestamps
base = dimensions[3] # Duration in milliseconds for the length of each latency interval bucket
heatmap_list = []
max_number = max([max(pauses_ms) for pauses_ms in datapoint_groups])
for times_seconds, pauses_ms in zip(timestamp_groups, datapoint_groups):
# create buckets to store the time information.
# first, compress into num_b buckets along the time X-axis.
x_b = [[] for i in range(x_bucket_count)]
out_of_range_time = 0
# populate buckets along the x axis.
for pause, time in zip(pauses_ms, times_seconds):
bucket_no = int(time / x_bucket_duration)
if bucket_no == x_bucket_count:
bucket_no = x_bucket_count - 1
x_b[bucket_no].append(pause)
elif bucket_no < x_bucket_count:
x_b[bucket_no].append(pause)
else:
out_of_range_time += 1
# create heatmap, which will be a 2d-array
heatmap = []
y_range_buckets = get_bucket_upper_ranges(base, y_bucket_count, max_number)
out_of_range_latency = 0
# go through each time interval, and sort the pauses there into frequency lists
for bucket in x_b:
yb = [0 for i in range(y_bucket_count)] # construct a 0 frequency list
for pause in bucket:
# determine which ms pause bucket
y_bucket_no = get_y_bucket_number(pause, base)
y_bucket_no = binary_search(y_range_buckets, pause)
if y_bucket_no == -1:
out_of_range_latency += 1
else:
yb[y_bucket_no] += 1
# Add the data to the 2d array
heatmap.append(yb)
heatmap = np.rot90(heatmap) # fix orientation
if out_of_range_time:
print(" Warning: " + str(out_of_range_time) + " values lies outside of the provided time range. Max value outside range: " + str (max(times_seconds)))
if out_of_range_latency:
print(" Warning: " + str(out_of_range_latency) + " values lies outside the provided range for latency. Max value outside range: " + str(max_number))
heatmap_list.append(np.array(heatmap))
dimensions.append(y_range_buckets)
return heatmap_list, dimensions