[gjs: 3/11] heapgraph: Add --hide-edge argument



commit 445802b3f6997701f2a239c1617dec054cc75a32
Author: Philip Chimento <philip chimento gmail com>
Date:   Thu Aug 8 20:59:56 2019 -0700

    heapgraph: Add --hide-edge argument
    
    If there are edges that you're not interested in, such as "prototype" or
    "group", this argument can be used to hide them.

 tools/heapgraph.md | 4 +++-
 tools/heapgraph.py | 7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/tools/heapgraph.md b/tools/heapgraph.md
index 09c9db5c..fb5dcd84 100644
--- a/tools/heapgraph.md
+++ b/tools/heapgraph.md
@@ -127,7 +127,7 @@ usage: heapgraph.py [-h] [--edge | --function | --string] [--count]
                     [--dot-graph] [--no-addr] [--diff-heap FILE]
                     [--no-gray-roots] [--no-weak-maps] [--show-global]
                     [--show-imports] [--hide-addr ADDR] [--hide-node LABEL]
-                    FILE TARGET
+                    [--hide-edge LABEL] FILE TARGET
 
 Find what is rooting or preventing an object from being collected in a GJS
 heap using a shortest-path breadth-first algorithm.
@@ -159,6 +159,8 @@ Node/Root Filtering:
                         Don't show roots with the heap address ADDR
   --hide-node LABEL, -hn LABEL
                         Don't show nodes with labels containing LABEL
+  --hide-edge LABEL, -he LABEL
+                        Don't show edges labelled LABEL
 ```
 
 ## See Also
diff --git a/tools/heapgraph.py b/tools/heapgraph.py
index 2b6d00c3..adec6e4c 100755
--- a/tools/heapgraph.py
+++ b/tools/heapgraph.py
@@ -99,6 +99,10 @@ filt_opts.add_argument('--hide-node', '-hn', dest='hide_nodes', action='append',
                                                  'GjsModule'],
                        help='Don\'t show nodes with labels containing LABEL')
 
+filt_opts.add_argument('--hide-edge', '-he', dest='hide_edges', action='append',
+                       metavar='LABEL', default=[],
+                       help="Don't show edges labeled LABEL")
+
 
 ###############################################################################
 # Heap Patterns
@@ -188,7 +192,8 @@ def parse_graph(fobj):
         e = edge_regex.match(line)
 
         if e:
-            if node_addr not in args.hide_addrs:
+            if (node_addr not in args.hide_addrs and
+                    e.group(3) not in args.hide_edges):
                 addEdge(node_addr, e.group(1), e.group(3))
         else:
             node = node_regex.match(line)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]