5

I have some stats in a trie which is generated periodically. I want to generate flame graphs on the difference between two tries. How do I do that?

t = pygtrie.StringTrie(separator=os.path.sep)

for dirpath, unused_dirnames, filenames in os.walk(ROOT_DIR):
    for filename in filenames:
        filename = os.path.join(dirpath, filename)
        try:
            filestat = os.stat(filename)
        except OSError:
            continue
        if stat.S_IFMT(filestat.st_mode) == stat.S_IFREG:
            t[filename] = filestat.st_size
hidefromkgb
  • 5,834
  • 1
  • 13
  • 44
Gyanendra Singh
  • 895
  • 2
  • 13
  • 30
  • But wait, why do you expect trie difference to be a flame graph? The only thing that can possibly become a flame graph is trie intersection. – hidefromkgb Sep 15 '19 at 15:22

1 Answers1

1

Not sure about the diff. But you can draw flame graph on files (or anything else if you produce the similar output) using FlameGraph tool.

Here is a topic from the author of this tool about how to make Flame graphs for file systems. Using this tool you need just execute following command to get chart.

./files.pl /Users | ./flamegraph.pl --hash --countname=bytes > out.svg

Here is similar tool - duviz, that creates similar chart, but for CLI not as an image output. Pros - it is written in Python.

wowkin2
  • 5,895
  • 5
  • 23
  • 66