{"id":22382493,"url":"https://github.com/jcoreio/profiler-server","last_synced_at":"2025-03-26T19:41:04.395Z","repository":{"id":40783929,"uuid":"227199179","full_name":"jcoreio/profiler-server","owner":"jcoreio","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-24T00:55:26.000Z","size":1053,"stargazers_count":0,"open_issues_count":27,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T01:41:38.706Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/jcoreio.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}},"created_at":"2019-12-10T19:27:42.000Z","updated_at":"2019-12-20T21:55:23.000Z","dependencies_parsed_at":"2023-02-13T07:00:41.650Z","dependency_job_id":null,"html_url":"https://github.com/jcoreio/profiler-server","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fprofiler-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fprofiler-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fprofiler-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fprofiler-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcoreio","download_url":"https://codeload.github.com/jcoreio/profiler-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245726847,"owners_count":20662545,"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-12-05T00:13:14.408Z","updated_at":"2025-03-26T19:41:04.366Z","avatar_url":"https://github.com/jcoreio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @jcoreio/profiler-server\n\n[![CircleCI](https://circleci.com/gh/jcoreio/profiler-server.svg?style=svg)](https://circleci.com/gh/jcoreio/profiler-server)\n[![Coverage Status](https://codecov.io/gh/jcoreio/profiler-server/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/profiler-server)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![npm version](https://badge.fury.io/js/%40jcoreio%2Fprofiler-server.svg)](https://badge.fury.io/js/%40jcoreio%2Fprofiler-server)\n\nREST server for running v8-profiler and downloading snapshots\n\n# API\n\n## `ProfilerRouter({ profiler: Profiler, maxDurationMillis?: number | null })`\n\n```js\nimport { ProfilerRouter } from '@jcoreio/profiler-server'\n```\n\nCreates an [ExpressJS Router](https://devdocs.io/express/index#express.router) that handles\nthe following routes:\n\n### Options\n\n- `profiler: Profiler` (**required**) - the profiler to use, for example `require('v8-profiler-next')`\n- `maxDurationMillis: number` (_optional_, default: 5 minutes) - the maximum cpu profile duration to allow\n\n### Example\n\n```js\nimport { ProfilerRouter } from '@jcoreio/profiler-server'\nimport profiler from 'v8-profiler-next'\nimport express from 'express'\nconst app = express()\napp.use(ProfilerRouter({ profiler }))\n```\n\n### `GET /cpu?durationMillis=\u003cinteger\u003e`\n\nProfiles the CPU for `durationMillis` milliseconds, and sends the CPU profile in the response.\n**You must set the timeout of the client request to more than `durationMillis`** or the request\nwill time out.\n\nIf a CPU profile is already in progress, responds with 418.\n\n### `GET /heap`\n\nTakes a heap snapshot and sends it in the response.\n\n### `GET /sampleHeapProfiling?durationMillis=\u003cinteger\u003e`\n\nProfiles heap sampling for `durationMillis` milliseconds, and sends the profile in the response.\n**You must set the timeout of the client request to more than `durationMillis`** or the request\nwill time out.\n\nIf a heap sampling profile is already in progress, responds with 418.\n\n#### Query parameters\n\n- `durationMillis` (**required**) the amount of time to profile in milliseconds\n- `interval` (**optional**) the sampling interval, in milliseconds (has no effect unless `depth` is also given)\n- `depth` (**optional**) the sampling depth (has no effect unless `interval` is also given)\n\n### `GET /gc`\n\nRuns the garbage collector.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fprofiler-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcoreio%2Fprofiler-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fprofiler-server/lists"}