{"id":20904689,"url":"https://github.com/sage/streamline-flamegraph","last_synced_at":"2025-05-13T05:30:48.031Z","repository":{"id":19420252,"uuid":"22662707","full_name":"Sage/streamline-flamegraph","owner":"Sage","description":null,"archived":true,"fork":false,"pushed_at":"2020-04-10T22:12:11.000Z","size":274,"stargazers_count":8,"open_issues_count":4,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-25T11:56:04.139Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-05T23:18:41.000Z","updated_at":"2024-05-29T16:22:52.000Z","dependencies_parsed_at":"2022-09-26T22:30:39.759Z","dependency_job_id":null,"html_url":"https://github.com/Sage/streamline-flamegraph","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fstreamline-flamegraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fstreamline-flamegraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fstreamline-flamegraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Fstreamline-flamegraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sage","download_url":"https://codeload.github.com/Sage/streamline-flamegraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253882718,"owners_count":21978540,"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","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":[],"created_at":"2024-11-18T13:18:30.341Z","updated_at":"2025-05-13T05:30:47.692Z","avatar_url":"https://github.com/Sage.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Flame graph](http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html) instrumentation for [streamline.js](https://github.com/Sage/streamlinejs), based on [Brendan Gregg's FlameGraph](https://github.com/brendangregg/FlameGraph)\n\n![](examples/perf-full.png?raw=true)\n\n\u003ca name=\"installation\"/\u003e\n\n## Installation\n\n``` sh\nnpm install streamline-flamegraph\n```\n\n\u003ca name=\"recording\"/\u003e\n\n## Recording\n\nFirst you need to instrument your code to record performance counters:\n\n``` javascript\nvar recorder = require('streamline-flamegraph/lib/record').create(options).run();\n```\n\nThis will start the recording and create a `perf-recorded.gz` file in the current working directory of the process.\n\nThe recording can be stopped by calling `recorder.stop()` but you don't need to call it if you want to record till the process exits.\n\nThe `options` argument allows you to pass configuration parameters (see [below](#configuration))\n\n\u003ca name=\"gen-graph\"/\u003e\n\n## Generating the flamegraph\n\nOnce you have recorded data, you need to transform it into a flame graph. This is done with a simple command:\n\n```sh\nbin/gen-graphs.sh\n```\n\nThis will generate two flame graphs in the current directory:\n\n* [perf-cpu.svg](examples/perf-cpu.png?raw=true): CPU only graph\n* [perf-full.svg](examples/perf-full.png?raw=true): CPU+IO graph\n\n\u003ca name=\"configuration\"/\u003e\n\n## Configuration\n\nYou can pass the following configuration options to the `create` call.\n\n``` javascript\n{\n\t// sampling rate, in milliseconds, 1 by default\n\trate: 1,\n\t// root of source tree (will be trimmed from full file names to get relative paths)\n\t// by default: \"\"\n\tsourceRoot: __dirname,\n\t// pattern for source link URLs\n\t// by default: \"file://{fullpath}#{line}\"\n\tsourceUrl: \"https://github.com/Sage/streamline-flamegraph/tree/master/{relpath}#L{line}\",\n}\n```\n\nThe `sourceUrl` option allows you to create hyperlinks to the your github repository, or to open your favorite source editor (for example `\"subl://open/?url=file://{fullpath}\u0026line={line}\"` for Sublime Text with `subl://` URL handler extension).\n\n## Gotchas\n\nThe flamegraph only displays streamline stacks (but it displays the _async_ stacks). If you want a complete graph including sync JS calls and C++ stacks, see https://gist.github.com/trevnorris/9616784).\n\nThe [3 main streamline modes (callbacks, fibers, generators)](https://github.com/Sage/streamlinejs#generation-options) are supported, but streamline's [fast mode](https://github.com/Sage/streamlinejs#fast-mode) must be off.\n\nAPI may still evolve so I haven't documented it yet.\n\n\n## Credits\n\nThanks to Brendan Gregg for the great Perl script (`deps/flamegraph.pl`).\n\n## License\n\nMIT (streamline.js) + CDDL (see `deps/flamegraph.pl`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage%2Fstreamline-flamegraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsage%2Fstreamline-flamegraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage%2Fstreamline-flamegraph/lists"}