winIDEA SDK
test_add_items.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_addtems():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 profCtrl = ic.CProfilerController2(connMgr, "test_addItems.trd", "w")
16
17 print("Adding 'main_loop_counter' variable in 'regular' mode...")
18 index = profCtrl.addVariable(0,
19 "main_loop_counter",
20 ic.CProfilerController2.EDATRegular)
21 print(f"\tDone, index: {index}")
22
23 print("Adding 'g_int' variable in 'state' mode...")
24 index = profCtrl.addStateVariable(0,
25 "g_int",
26 ic.CProfilerController2.EStateDefEnum,
27 "g_int")
28 print(f"\tDone, index: {index}")
29
30 print("Adding trace messages in 'regular' data mode...")
31 index = profCtrl.addTraceMessage(0,
32 "",
33 ic.CProfilerController2.EDATRegular,
34 ic.CProfilerController2.ESingleData)
35 print(f"\tDone, index: {index}")
36
37 print("Adding function 'main'...")
38 index = profCtrl.addFunction(0, "main", False)
39 print(f"\tDone, index: {index}")
40
41 print("Adding multiple functions 'main'...")
42 functions = ic.StrVector()
43 functions.append("target_init")
44 functions.append("get_random")
45 profCtrl.addFunctions(0, functions)
46
47
48if __name__ == "__main__":
49 test_addtems()