{"id":13527196,"url":"https://github.com/hyj1991/v8-analytics","last_synced_at":"2025-04-14T00:43:28.937Z","repository":{"id":57389969,"uuid":"79085188","full_name":"hyj1991/v8-analytics","owner":"hyj1991","description":"v8 engine's cpu \u0026 heap-memory analytics","archived":false,"fork":false,"pushed_at":"2017-07-01T14:46:23.000Z","size":581,"stargazers_count":186,"open_issues_count":0,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-22T01:21:39.107Z","etag":null,"topics":["analytics","bailout","bailout-reason","cpu","cpu-profiler","heap-memory","heap-memory-analytics","v8-profiler"],"latest_commit_sha":null,"homepage":"","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/hyj1991.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":"2017-01-16T05:17:26.000Z","updated_at":"2024-05-17T13:56:36.000Z","dependencies_parsed_at":"2022-09-15T05:04:04.513Z","dependency_job_id":null,"html_url":"https://github.com/hyj1991/v8-analytics","commit_stats":null,"previous_names":["hyj1991/v8-analystics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyj1991%2Fv8-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyj1991%2Fv8-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyj1991%2Fv8-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyj1991%2Fv8-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyj1991","download_url":"https://codeload.github.com/hyj1991/v8-analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804721,"owners_count":21164127,"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":["analytics","bailout","bailout-reason","cpu","cpu-profiler","heap-memory","heap-memory-analytics","v8-profiler"],"created_at":"2024-08-01T06:01:43.012Z","updated_at":"2025-04-14T00:43:28.915Z","avatar_url":"https://github.com/hyj1991.png","language":"JavaScript","funding_links":[],"categories":["Repository","JavaScript"],"sub_categories":["Performance Profiling/Analysis"],"readme":"[中文版](https://github.com/hyj1991/v8-cpu-analysis/blob/master/README_ZH.md)\n\n[![npm version](https://badge.fury.io/js/v8-cpu-analysis.svg)](https://badge.fury.io/js/v8-cpu-analysis)\n[![Package Quality](http://npm.packagequality.com/shield/v8-cpu-analysis.svg)](http://packagequality.com/#?package=v8-cpu-analysis)\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/hyj1991/v8-cpu-analysis/LICENSE)\n\n# v8-analytics/v8-cpu-analysis\n\nAnalysis the cpu \u0026 heap-memory log file which created by v8-profiler \u0026 heapdump，it can:\n\n* **show you functions which are optimized failed by v8 engine**\n* **show you functions which exectime greater than your expected**\n* **show you suspicious memory leak point**\n\n## Why Two Names？\n\n```v8-analytics``` is completely equivalent to ```v8-cpu-analysis```, there is no difference between them.\n\nBeacuse I want to introduce v8 engine's heap-memory analytics, so I think ```cpu``` in package name is not suitable. More, to be compatible with before, I chose them published comletely equivalent.\n\n## Installation\n\n### For Global\n\n```bash\n$ npm install v8-analytics -g\n```\n\nor\n\n```bash\n$ npm install v8-cpu-analysis -g\n```\n\n### For Embedded JS code\n\n```bash\n$ npm install v8-analytics\n```\n\nor\n\n```bash\n$ npm install v8-cpu-analysis\n```\n\n### Test\nif you install -g, try:\n\n```bash\n//test bailout\n$ va test bailout\n$ va test bailout --only\n//test timeout\n$ va test timeout\n$ va test timeout 200\n$ va test timeout 200 --only\n$ va test leak\n```\n```va test bailout --only``` can list you all functions which are deoptimized, and it's deoptimization reason.\n\n```va test timeout 200 --only``` can list you all function which exectime \u003e 200ms.\n\n```va test leak``` cans list you suspicious leak point in your project.\n\n## Quick Start\nYou can use this at the command line or embedded in your js code\n\n### I. Command Line\n\n#### Find Function Bailout Reason\n\nThe ```xxx.cpu.json``` file created by v8-profiler:\n\n```bash\n$ va bailout xxx.cpu.json\n```\n\nThis will list all Function, and turn the deoptimized function to red. You can also use like that:\n\n```bash\n$ va bailout xxx.cpu.json --only\n```\nThis will only list the deoptimized functions.\n\n#### Find Funtion Exectime Greater Than Expected\n\n```bash\n$ va timeout xxx.cpu.json\n```\n\nThis will list all Function, and their exectime\n\n```bash\n$ va timeout xxx.cpu.json 200\n```\n\nThis will list all Function ,and turn the functions which exectime \u003e 200ms to red.\n\n```bash\n$ va timeout xxx.cpu.json 200 --only\n```\n\nThis will only list the functions which exectime \u003e 200ms.\n\n#### Find suspicious memory leak point\n\n```\n$ va leak xxx.mem.json\n```\n\nThis will show you suspicous leak ponit in your node.js project.\n\n### II. Embedded JS Code\n\n```js\n'use strict';\nconst fs = require('fs');\nconst v8Analytics = require('v8-analytics');\n//or you can use following, they're equival\n//const v8Analytics = require('v8-cpu-analysis');\n\n//list all js function and it's execTime\nconst json = JSON.parse(fs.readFileSync('./test.cpu.json'));\nconst str = v8Analytics(json);\nconsole.log(str);\n\n//list you heap memory info\nconst json = JSON.parse(fs.readFileSync('./test.mem.json'));\nconst {leakPoint, heapMap, statistics} = analysisLib.memAnalytics(allData)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyj1991%2Fv8-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyj1991%2Fv8-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyj1991%2Fv8-analytics/lists"}