{"id":19054380,"url":"https://github.com/datadog/pprof-format","last_synced_at":"2025-04-24T03:14:40.008Z","repository":{"id":62953074,"uuid":"519282946","full_name":"DataDog/pprof-format","owner":"DataDog","description":"Pure JavaScript pprof encoder and decoder","archived":false,"fork":false,"pushed_at":"2024-03-20T18:45:26.000Z","size":315,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-24T03:14:32.635Z","etag":null,"topics":["decoder","encoder","nodejs","pprof"],"latest_commit_sha":null,"homepage":"","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/DataDog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-29T16:37:26.000Z","updated_at":"2025-03-18T17:58:33.000Z","dependencies_parsed_at":"2024-06-18T19:51:40.692Z","dependency_job_id":"a961acee-f9d5-4865-a28a-bbcebe8a5149","html_url":"https://github.com/DataDog/pprof-format","commit_stats":{"total_commits":17,"total_committers":4,"mean_commits":4.25,"dds":0.5882352941176471,"last_synced_commit":"e12c635ecf740e12b8025966d833c6cee6c886e9"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fpprof-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fpprof-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fpprof-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fpprof-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataDog","download_url":"https://codeload.github.com/DataDog/pprof-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250552077,"owners_count":21449165,"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":["decoder","encoder","nodejs","pprof"],"created_at":"2024-11-08T23:38:12.166Z","updated_at":"2025-04-24T03:14:39.980Z","avatar_url":"https://github.com/DataDog.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pprof-format\n\nA pure JavaScript PProf encoder and decoder library with zero dependencies and\nbrowser support. No protobuf, because the pprof spec only uses a tiny fraction\nof the features. Uint8Arrays rather than Node.js buffers so it can work in the\nbrowser. Carefully tuned to be as fast as possible.\n\n## Install\n\n```sh\nnpm install pprof-format\n```\n\n## Usage\n\n```js\nimport {\n  Function,\n  Label,\n  Line,\n  Location,\n  Mapping,\n  Profile,\n  Sample,\n  ValueType,\n  StringTable\n} from 'pprof-format'\n\nconst stringTable = new StringTable()\n\nconst periodType = new ValueType({\n  type: stringTable.dedup('cpu'),\n  unit: stringTable.dedup('nanoseconds')\n})\n\nconst fun = new Function({\n  id: 1,\n  name: stringTable.dedup('name'),\n  systemName: stringTable.dedup('system name'),\n  filename: stringTable.dedup('filename'),\n  startLine: 123\n})\n\nconst mapping = new Mapping({\n  id: 1\n})\n\nconst location = new Location({\n  id: 1,\n  mappingId: mapping.id,\n  address: 123,\n  line: [\n    new Line({\n      functionId: fun.id,\n      line: 1234\n    })\n  ]\n})\n\nconst profile = new Profile({\n  sampleType: [\n    new ValueType({\n      type: stringTable.dedup('sample'),\n      unit: stringTable.dedup('count')\n    }),\n    periodType\n  ],\n  sample: [\n    new Sample({\n      locationId: [location.id],\n      value: [123, 456],\n      label: [\n        new Label({\n          key: stringTable.dedup('label key'),\n          str: stringTable.dedup('label str')\n        }),\n        new Label({\n          key: stringTable.dedup('label key'),\n          num: 12345,\n          numUnit: stringTable.dedup('label num unit')\n        })\n      ]\n    })\n  ],\n  mapping: [mapping],\n  location: [location],\n  'function': [fun],\n  stringTable,\n  timeNanos: BigInt(Date.now()) * 1_000_000n,\n  durationNanos: 1234,\n  periodType,\n  period: 1234 / 2,\n  comment: [\n    stringTable.dedup('some comment')\n  ]\n})\n\n// Encode to Uint8Array\nconsole.log(profile.encode())\n\n// Decode from Uint8Array\nconst copied = Profile.decode(profile.encode())\n\n// Should match the structure of the original profile object\nconsole.log(copied)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fpprof-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatadog%2Fpprof-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fpprof-format/lists"}