Netflix / flamescope

FlameScope is a visualization tool for exploring different time ranges as Flame Graphs.
Apache License 2.0
3k stars 168 forks source link

Heatmap offsets memory cache not being populated #141

Closed Minusome closed 2 years ago

Minusome commented 2 years ago

In flamescope/app/controllers/heatmap.py:

# global cache
offsets_cache = {}
offsets_mtimes = {}

def _read_offsets(file_path, file_type):
    # fetch modification timestamp and check cache
    mtime = getmtime(file_path)
    if file_path in offsets_cache:
        if mtime == offsets_mtimes[file_path]:
            # use cached heatmap
            return offsets_cache[file_path]
    if file_type == 'perf':
        return perf_read_offsets(file_path)
    elif file_type == 'cpuprofile':
        return cpuprofile_read_offsets(file_path)
    elif file_type == 'trace_event':
        return trace_event_read_offsets(file_path, mtime)
    elif file_type == 'nflxprofile':
        return nflxprofile_readoffsets(file_path)
    else:
        raise InvalidFileError('Unknown file type.')

offsets_cache and offsets_mtimes are checked but never written to.