https://github.com/xnslong/guess-stack
This is a tool to recover deep stacks whose root are lost, so that they can align with each other again in FlameGraphs.
https://github.com/xnslong/guess-stack
flamegraph pprof
Last synced: about 2 months ago
JSON representation
This is a tool to recover deep stacks whose root are lost, so that they can align with each other again in FlameGraphs.
- Host: GitHub
- URL: https://github.com/xnslong/guess-stack
- Owner: xnslong
- License: mit
- Created: 2022-03-06T14:35:23.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-02T06:17:42.000Z (about 3 years ago)
- Last Synced: 2024-06-19T15:15:56.990Z (over 1 year ago)
- Topics: flamegraph, pprof
- Language: Go
- Homepage:
- Size: 1.44 MB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# guess-stack
When taking samples of call stacks from a process in flight, some root stack nodes may be lost if the stack is too deep.
Then the stacks cannot align with each other anymore, it will be hard to analyze.
For example, following is a FlameGraph whose stacks have their root call nodes lost, it becomes hard to understand.

This tool will try to recover the stacks by guessing the missing stack nodes, enabling the stacks to align with each other again. Following is the recovered version of the previous FlameGraph. Then we can analyze it easily.

## How to guess?
Suppose we have 2 stacks in a graph: A & B. When the root end nodes of a stack A overlaps nodes in stack B,
then we guess stack A should have trimmed some root nodes the same as those in stack B under the overlapping nodes
(shown in the following 'guess' graph).

The longer the overlapping part is, the more trustable the guess is.
If you are interested in the algorithm to realize it, please refer to [algorithm](core/README.md).
# Module introduction
Since there are a variety of profile file types, we will provide several tools to fix each profile file type.
* [guess-pprof](guess-pprof/README.md): a tool to fix the golang pprof profile. (taken
by [pprof](https://github.com/google/pprof))
* [guess-fold](guess-fold/README.md): a tool to fix the folded stack type of call stacks defined by [FlameGraph]. it's will be more commonly used for programs written in a variety oflanguages.
[FlameGraph]: https://github.com/brendangregg/FlameGraph
The previous tools are working based on the following core module.
* [core](core): The core module providing an implementation to fix the missing nodes by guessing. This module will be
used by each other modules.
# Installation
guess-pprof
```bash
go install github.com/xnslong/guess-stack/guess-pprof@latest
```
guess-fold
```bash
go install github.com/xnslong/guess-stack/guess-fold@latest
```