GithubHelp home page GithubHelp logo

xnslong / guess-stack Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 0.0 1.47 MB

This is a tool to recover deep stacks whose root are lost, so that they can align with each other again in FlameGraphs.

License: MIT License

Go 100.00%
flamegraph pprof

guess-stack's Introduction

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.

mis-aligned version

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.

aligned version

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).

guess

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.

Module introduction

Since there are a variety of profile file types, we will provide several tools to fix each profile file type.

  • guess-pprof: a tool to fix the golang pprof profile. (taken by pprof)
  • guess-fold: 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.

The previous tools are working based on the following core module.

  • 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

go install github.com/xnslong/guess-stack/guess-pprof@latest

guess-fold

go install github.com/xnslong/guess-stack/guess-fold@latest

guess-stack's People

Contributors

xnslong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

guess-stack's Issues

We can reduce complexity from O(n^2) to O(n) with prefix tree

Currently, we try to join a stack with any other stack to test the best join point. Suppose there are n stacks, the complexity will be
C=n * (n-1) = O(n^2).

But if we first organize all stacks into a prefix tree. When a stack try to match a route in the prefix tree, it will finish all join point to this stack computed for all stacks in the tree. Then we only need O(n) matches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.