{"id":22877381,"url":"https://github.com/nilsdeppe/flamegraphfilter","last_synced_at":"2025-08-29T03:34:33.015Z","repository":{"id":111790056,"uuid":"133069310","full_name":"nilsdeppe/FlameGraphFilter","owner":"nilsdeppe","description":"FlameGraphFilter allows you to quickly down sample the amount of data displayed an a flamegraph, especially useful when profiling C++ programs using Linux perf.","archived":false,"fork":false,"pushed_at":"2022-09-10T13:47:50.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-29T15:31:53.231Z","etag":null,"topics":["cpp","cxx","flamegraph","performance-analysis","profiling"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilsdeppe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-11T17:29:25.000Z","updated_at":"2018-05-11T17:33:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"f47df86a-3157-4eab-aae2-0b7ce797b059","html_url":"https://github.com/nilsdeppe/FlameGraphFilter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nilsdeppe/FlameGraphFilter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsdeppe%2FFlameGraphFilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsdeppe%2FFlameGraphFilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsdeppe%2FFlameGraphFilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsdeppe%2FFlameGraphFilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilsdeppe","download_url":"https://codeload.github.com/nilsdeppe/FlameGraphFilter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsdeppe%2FFlameGraphFilter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272619556,"owners_count":24965416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cxx","flamegraph","performance-analysis","profiling"],"created_at":"2024-12-13T15:36:57.728Z","updated_at":"2025-08-29T03:34:32.955Z","avatar_url":"https://github.com/nilsdeppe.png","language":"C++","readme":"# FlameGraphFilter\n\nFlameGraphFilter is used to reduce the amount of data displayed on inverse\n[flamegraphs](https://github.com/brendangregg/FlameGraph). The main use case I\nfound was to construct a \"bottom-up\" or\ncallgraph of callees view as a flamegraph. If all the low-percentage functions\nare included viewing the flamegraph in a browser becomes slow. However, by\nignoring functions that take less than 0.5% of the total runtime and by limiting\nthe displayed stack depth a general overview of which functions are consuming\nthe most time can be quickly obtained. The next step is to filter the flamegraph\nto only display the functions you are interested in and deepen the stack\ntrace. It is then easy to get a detailed overview of how the slow functions are\nbeing invoked and where code changes are necessary.\n\n**Note:** I work with C++ code and so FlameGraphFilter was designed to suit my\nneeds there.\n\n# Installation\n\nTo install FlameGraphFilter you must have a working C++ compiler,\nBoost.ProgramOptions installed, and CMake installed. To build FlameGraphFilter:\n\n- `git clone FLAMEGRAPH`\n- `cd ./FlameGraphFilter \u0026\u0026 mkdir build \u0026\u0026 cd build \u0026\u0026 cmake .. \u0026\u0026 make`\n\n# Tutorial\n\nYou should first familiarize yourself with\n[FlameGraph](https://github.com/brendangregg/FlameGraph). Once you understand\nthe basics of FlameGraph then you can use the filter to improve your profiling\nexperience.\n\nFrameGraphFilter takes the folded stacks produced by the `stackcollapse*.pl`\nscripts that are part FrameGraph and limits the data that will be displayed on\nthe reverse FlameGraph. I prefer thinking of performance from the call graph of\ncallees/bottom-up perspective, which is where FlameGraph tends to struggle with\ntoo much data. FlameGraphFilter allows you to show only functions that take up,\nsay more than 0.5% of the total run time, and to also limit the stack depth\ndisplayed. These two features allow you to quickly figure out which parts of\nyour code that are consuming the most time. You can then filter the data to only\nshow the lowest level functions that match user-specified regular expressions.\n\nLet's start off after the\n[Fold stacks](https://github.com/brendangregg/FlameGraph#2-fold-stacks) section\nof the FlameGraph tutorial. You should have a collapsed stack to work with. If\nyou render the raw stack with `framegraph --reverse` the resulting file might be\nquite large (well over 5MB). These large SVGs tend to render quite slowly\nsometimes and so we want to reduce the amount irrelevant information. To do this\nrun `flamegraphfilter --stack-limit 8 --cutoff-percentage -o out.folded.filtered\nout.folded`. This will generate a new folded stack file named\n`out.folded.filtered` that only contains functions that take up more than 0.5%\nof the total run time, and only shows them to a stack depth of 8. Now we can\ngenerate a new SVG using `flamegraph --reverse out.folded.filtered \u003e\nfiltered.svg` which will be quicker too load. If load times are still too long\ntry either increasing the cutoff percentage or decreasing the stack limit. With\na quick loading flamegraph you should be able to identify the functions that are\ntaking up the most time. Let's say it `malloc` and the member functions of a\n`Vector` class.\n\nTo only see what these functions are doing we create a new folded file using\n`flamegraphfilter --cutoff-percentage 0 --show malloc --show \"Vector.*\" -o\nout.folded.malloc_vector out.folded`. We are interested in seeing all functions\nthat satisfy the regular expressions so we set the cutoff percentage to `0`. The\ndefault stack-limit is `0`, which means show the whole stack. Next run\n`flamegraph --reverse out.folded.malloc_vector \u003e malloc_vector.svg` to get a\nflamegraph that loads quickly and shows the full stack so you can analyze how\nthe slow functions were called.\n\n# Contributing\n\nContributions are more than welcome, and if you're more capable than I am at\nwriting perl code I think it would be great to have this functionality added\ninto FlameGraph itself :)\n\n# Maintenance\n\nI expect that FlameGraphFilter will be quite low maintenance since it very\nquickly suited my needs completely. Thus, just because there's no activity for a\nlong time does not mean the software isn't being updated, it just might not need\nupdates often :)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsdeppe%2Fflamegraphfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilsdeppe%2Fflamegraphfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsdeppe%2Fflamegraphfilter/lists"}