Module colors

merge-requests/8/head
Bob Mottram 2020-12-23 17:56:25 +00:00
parent d3261de520
commit f7d9864093
1 changed files with 19 additions and 0 deletions

View File

@ -2847,6 +2847,7 @@ def testFunctions():
print('Function: ' + name + '') print('Function: ' + name + '')
print('Constructing function call graph') print('Constructing function call graph')
maxModuleCalls = 1
for modName, modProperties in modules.items(): for modName, modProperties in modules.items():
lineCtr = 0 lineCtr = 0
for line in modules[modName]['lines']: for line in modules[modName]['lines']:
@ -2863,12 +2864,30 @@ def testFunctions():
if modules[modName].get('calls'): if modules[modName].get('calls'):
if modCall not in modules[modName]['calls']: if modCall not in modules[modName]['calls']:
modules[modName]['calls'].append(modCall) modules[modName]['calls'].append(modCall)
if len(modules[modName]['calls']) > \
maxModuleCalls:
maxModuleCalls = \
len(modules[modName]['calls'])
else: else:
modules[modName]['calls'] = [modCall] modules[modName]['calls'] = [modCall]
lineCtr += 1 lineCtr += 1
callGraphStr = 'digraph EpicyonModules {\n\n' callGraphStr = 'digraph EpicyonModules {\n\n'
callGraphStr += ' graph [fontsize=10 fontname="Verdana" compound=true];\n' callGraphStr += ' graph [fontsize=10 fontname="Verdana" compound=true];\n'
callGraphStr += ' node [shape=record fontsize=10 fontname="Verdana"];\n\n' callGraphStr += ' node [shape=record fontsize=10 fontname="Verdana"];\n\n'
# colors of modules nodes
for modName, modProperties in modules.items():
if not modProperties.get('calls'):
callGraphStr += ' "' + modName + \
'" [fillcolor = yellow style=filled];\n'
continue
if len(modProperties['calls']) < int(maxModuleCalls / 4):
callGraphStr += ' "' + modName + \
'" [fillcolor = orange style=filled];\n'
else:
callGraphStr += ' "' + modName + \
'" [fillcolor = red style=filled];\n'
callGraphStr += '\n'
# connections between modules
for modName, modProperties in modules.items(): for modName, modProperties in modules.items():
if not modProperties.get('calls'): if not modProperties.get('calls'):
continue continue