+cleanup *blacllist
This commit is contained in:
parent
2519452834
commit
afabbd3cfb
39
srcxray.py
39
srcxray.py
|
@ -22,10 +22,29 @@ from networkx.drawing.nx_agraph import *
|
||||||
from networkx.generators.ego import *
|
from networkx.generators.ego import *
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
import difflib
|
import difflib
|
||||||
|
import glob
|
||||||
|
from pathlib import *
|
||||||
|
|
||||||
|
black_list = ('aligned __attribute__ unlikely typeof u32'
|
||||||
|
'PVOP_CALLEE0 PVOP_VCALLEE0 PVOP_VCALLEE1 if trace_hardirqs_off'
|
||||||
|
'i NULL likely unlikely true false test_bit NAPI_GRO_CB clear_bit '
|
||||||
|
'atomic_read preempt_disable preempt_enable container_of ENOSYS '
|
||||||
|
'READ_ONCE u64 u8 _RET_IP_ ret current '
|
||||||
|
'AT_FDCWD fdput EBADF file_inode '
|
||||||
|
'ssize_t path_put __user '
|
||||||
|
'list_empty memcpy size_t loff_t pos d_inode dput copy_to_user EIO bool out IS_ERR '
|
||||||
|
'EPERM rcu_read_lock rcu_read_unlock spin_lock spin_unlock list_for_each_entry kfree '
|
||||||
|
'GFP_KERNEL ENOMEM EFAULT ENOENT EAGAIN PTR_ERR PAGE_SHIFT PAGE_SIZE '
|
||||||
|
'pgoff_t pte_t pmd_t HPAGE_PMD_NR PageLocked entry swp_entry_t next unlock_page spinlock_t end start '
|
||||||
|
' VM_BUG_ON VM_BUG_ON_PAGE BDI_SHOW max '
|
||||||
|
'ssize_t path_put __user '
|
||||||
|
'list_del compound_head list_add cond_resched put_page nr_pages min spin_lock_irqsave IS_ENABLED '
|
||||||
|
'EBUSY UL NODE_DATA pr_err memset list size ptl PAGE_MASK pr_info offset addr get_page sprintf '
|
||||||
|
'INIT_LIST_HEAD NUMA_NO_NODE spin_unlock_irqrestore mutex_unlock mutex_lock '
|
||||||
|
'page_to_nid page_to_pfn pfn page_zone pfn_to_page'
|
||||||
|
'BUG BUG_ON flags WARN_ON_ONCE ENODEV cpu_to_le16 cpumask_bits '
|
||||||
|
'ERR_PTR ENOTSUPP EOPNOTSUPP EOPNOTSUPP WARN_ON EINVAL ').split()
|
||||||
|
|
||||||
black_list = ['aligned', '__attribute__', 'unlikely', 'typeof', 'u32',
|
|
||||||
'PVOP_CALLEE0', 'PVOP_VCALLEE0', 'PVOP_VCALLEE1', 'if',
|
|
||||||
'trace_hardirqs_off']
|
|
||||||
|
|
||||||
level_limit = 8
|
level_limit = 8
|
||||||
limit = 100000
|
limit = 100000
|
||||||
|
@ -366,9 +385,18 @@ def syscalls():
|
||||||
# F=sys_mount; srcxray.py "digraph_print(import_cflow(),['$F'])" > $F.tree
|
# F=sys_mount; srcxray.py "digraph_print(import_cflow(),['$F'])" > $F.tree
|
||||||
# srcxray.py "leaves(read_dot('a.dot'))"
|
# srcxray.py "leaves(read_dot('a.dot'))"
|
||||||
# srcxray.py "most_used(read_dot('a.dot'))"
|
# srcxray.py "most_used(read_dot('a.dot'))"
|
||||||
|
# srcxray.py "digraph_print(read_dot('a.dot'))"
|
||||||
# srcxray.py "digraph_print(reduce_graph(reduce_graph(read_dot('a.dot'))))"
|
# srcxray.py "digraph_print(reduce_graph(reduce_graph(read_dot('a.dot'))))"
|
||||||
# srcxray.py "pprint(most_used(read_dot('a.dot')))"
|
# srcxray.py "pprint(most_used(read_dot('a.dot')))"
|
||||||
|
|
||||||
|
def cleanup(a):
|
||||||
|
dg = read_dot(a)
|
||||||
|
print(dg.number_of_edges())
|
||||||
|
dg.remove_nodes_from(black_list)
|
||||||
|
print(dg.number_of_edges())
|
||||||
|
write_dot(dg, a)
|
||||||
|
|
||||||
|
|
||||||
def leaves(dg):
|
def leaves(dg):
|
||||||
# [x for x in G.nodes() if G.out_degree(x)==0 and G.in_degree(x)==1]
|
# [x for x in G.nodes() if G.out_degree(x)==0 and G.in_degree(x)==1]
|
||||||
return {n: dg.in_degree(n) for (n, d) in dg.out_degree if not d}
|
return {n: dg.in_degree(n) for (n, d) in dg.out_degree if not d}
|
||||||
|
@ -483,8 +511,9 @@ def import_cflow(a=None):
|
||||||
if n <= nprev:
|
if n <= nprev:
|
||||||
stack = stack[:n - nprev - 1]
|
stack = stack[:n - nprev - 1]
|
||||||
# print(n, id, stack)
|
# print(n, id, stack)
|
||||||
if len(stack):
|
if id not in black_list:
|
||||||
cf.add_edge(stack[-1], id)
|
if len(stack):
|
||||||
|
cf.add_edge(stack[-1], id)
|
||||||
stack.append(id)
|
stack.append(id)
|
||||||
nprev = n
|
nprev = n
|
||||||
return cf
|
return cf
|
||||||
|
|
Loading…
Reference in New Issue