You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

v8.d.ts 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. declare module "v8" {
  2. import { Readable } from "stream";
  3. interface HeapSpaceInfo {
  4. space_name: string;
  5. space_size: number;
  6. space_used_size: number;
  7. space_available_size: number;
  8. physical_space_size: number;
  9. }
  10. // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */
  11. type DoesZapCodeSpaceFlag = 0 | 1;
  12. interface HeapInfo {
  13. total_heap_size: number;
  14. total_heap_size_executable: number;
  15. total_physical_size: number;
  16. total_available_size: number;
  17. used_heap_size: number;
  18. heap_size_limit: number;
  19. malloced_memory: number;
  20. peak_malloced_memory: number;
  21. does_zap_garbage: DoesZapCodeSpaceFlag;
  22. }
  23. function getHeapStatistics(): HeapInfo;
  24. function getHeapSpaceStatistics(): HeapSpaceInfo[];
  25. function setFlagsFromString(flags: string): void;
  26. /**
  27. * Generates a snapshot of the current V8 heap and returns a Readable
  28. * Stream that may be used to read the JSON serialized representation.
  29. * This conversation was marked as resolved by joyeecheung
  30. * This JSON stream format is intended to be used with tools such as
  31. * Chrome DevTools. The JSON schema is undocumented and specific to the
  32. * V8 engine, and may change from one version of V8 to the next.
  33. */
  34. function getHeapSnapshot(): Readable;
  35. /**
  36. *
  37. * @param fileName The file path where the V8 heap snapshot is to be
  38. * saved. If not specified, a file name with the pattern
  39. * `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be
  40. * generated, where `{pid}` will be the PID of the Node.js process,
  41. * `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from
  42. * the main Node.js thread or the id of a worker thread.
  43. */
  44. function writeHeapSnapshot(fileName?: string): string;
  45. }