This diff tries to show the low level structures and the high level APIs for interacting with HTR (hierarchical trace representation). Most of the ideas are commented in the code. I want to get some feedback with this diff, but the actual implementation would be left for other diffs.
I describe in the code two storage strategies: in memory and on disk. Besides that, I mention two extensions: a time analyzer and a symbol index. I don't intent to implement them right away. I'm thinking about starting with the in memory one without adding many abstractions to the code, and also I'd implement first only the time analyzer. Later, we could continue implemeting the other parts mentioned in this diff, but at least I want to think about them now to make sure the basic design doesn't need a complete redesign once we want to add the other features.
I show at the end and snippet of a practical traversal of the HTR with timing information. Making sure that this part looks intuitive is important.
What I don't include here is the algorithm for creating the call tree. That's out of the scope of this diff. I want to focus first on the interfaces, as that's the part that should change the least. The algorithm can be implemented incrementally.
Just like in the original HTR design, if you remove this abstraction, and store indices as indices in each layer, then you don't have to create separate versions for in memory and in disk, as the layers become very easily serializable.