{"id":13813171,"url":"https://github.com/nylas/nylas-perftools","last_synced_at":"2025-05-14T22:32:03.272Z","repository":{"id":76969572,"uuid":"42278762","full_name":"nylas/nylas-perftools","owner":"nylas","description":"Distributed profiling on the cheap","archived":false,"fork":false,"pushed_at":"2019-07-09T13:36:47.000Z","size":290,"stargazers_count":563,"open_issues_count":7,"forks_count":58,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-11-19T07:41:01.655Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nylas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-09-11T00:49:57.000Z","updated_at":"2024-10-17T13:35:06.000Z","dependencies_parsed_at":"2023-02-27T05:30:59.027Z","dependency_job_id":null,"html_url":"https://github.com/nylas/nylas-perftools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnylas-perftools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnylas-perftools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnylas-perftools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylas%2Fnylas-perftools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nylas","download_url":"https://codeload.github.com/nylas/nylas-perftools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254239831,"owners_count":22037773,"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-08-04T04:01:05.788Z","updated_at":"2025-05-14T22:31:58.251Z","avatar_url":"https://github.com/nylas.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"This is a collection of minimalist utilities for profiling Python programs. The motivation behind them is described in our [blog post](https://www.nylas.com/blog/performance).\n\n\n# py2devtools\nThe profile visualizer that's built into the Chrome developer tools is pretty rad. `py2devtools.py` contains instrumentation to create a `.cpuprofile` file from a Python program that can be loaded into the developer tools. See the module docstring for details.\n\n\n# stacksampler\n\n`stacksampler.py` contains a sampling profiler, along with a minimal embedded HTTP server to expose its data. It's built to work with [gevented](https://github.com/gevent/gevent) applications, but can be adapted to work without. Assuming gevent, drop\n\n```\nimport stacksampler\ngevent.spawn(stacksampler.run_profiler)\n```\n\ninto your code, run your application, and then do\n\n```\ncurl localhost:16384\n```\n\nto get profiling data. See the module docstring for more details.\n\n\n# The stackcollector agent\n\n![Screenshot](/images/screenshot.png)\n\nThe `stackcollector` package adds basic support for automatically collecting and visualizing profiles from distributed processes. It has two parts: a long-running collector agent that periodically gets samples from processes, and a frontend that serves visualizations. Data is timestamped and persisted using gdbm, allowing for time-based querying.\n\n## Installation\n\n```\n# create a directory for data files\nsudo mkdir -p /var/lib/stackcollector\nsudo chmod a+rw /var/lib/stackcollector\n\nvirtualenv .\nsource bin/activate\npython setup.py install\n```\n\n## Running the collector\n\nThe collector assumes that processes expose profiles in the [flamegraph line format](https://github.com/brendangregg/FlameGraph#2-fold-stacks) over HTTP, as implemented by `stacksampler.py`.\n\n```\n# Every minute, gather stacks from a local process listening on port 16384.\npython -m stackcollector.collector --host localhost --ports 16384 --interval 60\n```\n\n## Running the visualizer\n\n```\npython -m stackcollector.visualizer --port 5555\n```\n\nThen visit e.g. `http://localhost:5555?from=-15minutes` to see data from the past 15 minutes.\n\n# Questions? Issues?\n\nDon't hesitate to get in touch!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnylas%2Fnylas-perftools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnylas%2Fnylas-perftools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnylas%2Fnylas-perftools/lists"}