1.0.2 • Published 2 years ago

nv-inspector-heapdump-s0-util v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-inspector-heapdump-s0-util

  • similiar to chrome F12-》memory-》snapshot
  • for server using

install

usage

    1. first use chrome F12 memory snapshot  OR  nodejs -pkg heapdump  to get the .snapshot file

    2. const {init_from_json,init_from_file} = require("nv-inspector-heapdump-s0-util")

        it will creat a big json graph AND some filter/search functions

example

            var x = await init_from_file("./DRAFT/heapdump.json")


            > edge = x.slct_all_shortcut_edges()[0]
            {
              from: { type: 'synthetic', name: 1, id: 1, self_size: 0 },
              type: 'shortcut',
              idxn: '2',
              to: { type: 'object', name: 'global', id: 4833, self_size: 40 }
            }


            > nd = x.slct_all_concatenated_string_nds()[0]

            > nd.from_nds
            [
              { type: 'synthetic', name: '(Stack roots)', id: 17, self_size: 0 },
              { type: 'synthetic', name: '(Stack roots)', id: 17, self_size: 0 },
              { type: 'synthetic', name: '(Stack roots)', id: 17, self_size: 0 },
              { type: 'synthetic', name: '(Stack roots)', id: 17, self_size: 0 },
              { type: 'synthetic', name: '(Stack roots)', id: 17, self_size: 0 },
              { type: 'object', name: 'Arguments', id: 5111, self_size: 32 },
              { type: 'code', name: 'REPL10', id: 5325, self_size: 128 },
              {
                type: 'array',
                name: '(object elements)',
                id: 58075,
                self_size: 48
              }
            ]
            > nd.to_nds
            [
              {
                type: 'string',
                name: 'x.writeSnapshot()\n',
                id: 58073,
                self_size: 40
              },
              { type: 'string', name: 1, id: 73, self_size: 16 },
              {
                type: 'hidden',
                name: 'system / Map (ConsOneByteString)',
                id: 213,
                self_size: 72
              }
            ]
            >

GETTERS

node

      nd.detachedness          nd.dict                  nd.from_nds
      nd.id                    nd.name                  nd.self_size             nd.to_nds
      nd.trace_node            nd.type

edge

       e.dict                  e.from                  e.idxn
       e.to                    e.type

APIS

    {
      init_from_json: [Function: init_from_json],
      init_from_file: [AsyncFunction: init_from_file]
    }

 x.DB                                x.EGTYPES                           x.NDTYPES
 x.find_all_context_nds              x.find_all_element_nds              x.find_all_hidden_nds
 x.find_all_internal_nds             x.find_all_property_nds             x.find_all_shortcut_nds
 x.find_all_weak_nds                 x.get_edge_between                  x.get_nd_by_id
 x.get_self_to_self_nds              x.group_nds_by_size                 x.slct_all_array_nds
 x.slct_all_bigint_nds               x.slct_all_closure_nds              x.slct_all_code_nds
 x.slct_all_concatenated_string_nds  x.slct_all_context_edges            x.slct_all_element_edges
 x.slct_all_hidden_edges             x.slct_all_hidden_nds               x.slct_all_internal_edges
 x.slct_all_native_nds               x.slct_all_number_nds               x.slct_all_object_nds
 x.slct_all_property_edges           x.slct_all_regexp_nds               x.slct_all_shortcut_edges
 x.slct_all_sliced_string_nds        x.slct_all_string_nds               x.slct_all_symbol_nds
 x.slct_all_synthetic_nds            x.slct_all_weak_edges               x.srch_edges_by_idx_or_name
 x.srch_nds_by_name

LICENSE

  • ISC