winIDEA SDK
sequence_diagram.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5"""
6This script processes data recorded by profiler and creates two types
7of diagrams - UML sequence diagrams and call graphs.
8
9
10Requirements for custom Python installations
11============================================
12
13Python, which is bundled with winIDEA, already has all dependencies
14configured.
15
161. - For sequence diagrams module 'seqdiag' has to be installed.
17 First download setuptools from:
18 https://pypi.python.org/pypi/setuptools#files
19 and install.
20 - Install 'seqdiag' (use correct path for your Python installation):
21 C:\Python27\Scripts\easy_install seqdiag
22
23 Alternatively (if the above steps failed) you can download seqdiag from:
24 https://pypi.python.org/pypi/seqdiag/
25 Uncompress it (7-zip can be used) and run:
26 python setup.py
27
282. Install graphviz. Windows installer can be downloaded from:
29 http://www.graphviz.org/Download_windows.php
30 The console or IDE where the scripts will be ran should be restarted
31 after the graphviz has been installed.
32
33See also help text in function _parse_cmd_line_options().
34"""
35
36import sys
37import traceback
38import isystem.seqAndCallDiag as scdiag
39
40
41def main():
42
43 profilerExportFile = '../../targetProjects/profilerSample-1.xml'
44 callGraphImageFName = '../../targetProjects/profilerSample-1.call'
45 seqDiagImageFName = '../../targetProjects/profilerSample-1.svg'
46 functionName = ''
47 isCreateSeqDiag = True
48 isCreateCallGraph = False
49 seqDiagCompactLevel = 4
50 isCreateSeqDiagImage = True
51 isCreateCallGraphImage = False
52 isOpenSeqDiagImage = True
53 isOpenCallGraphImage = False
54 variableName = ''
55 is_binary_timeline = False # set to True, if your profiler export has binary timeline
56
57 try:
58 scdiag.generateDiagrams('',
59 profilerExportFile,
60 callGraphImageFName,
61 seqDiagImageFName,
62 '',
63 isCreateSeqDiag, isCreateCallGraph,
64 4,
65 isCreateSeqDiagImage, isCreateCallGraphImage,
66 isOpenSeqDiagImage, isOpenCallGraphImage,
67 variableName, is_binary_timeline)
68 except Exception as ex:
69 print(str(ex), file=sys.stderr)
70 traceback.print_exc()
71
72
73if __name__ == "__main__":
74 main()