6This script opens a window with chart and reads and draws values of target
7variable 'iCounter' in real-time for 5 seconds.
8Real-time access must be enabled in winIDEA:
9Debug | Debug Options ... | Memory Access | check 'Allow real-time ...',
10 uncheck 'Allow monitor ...'
11Debug | Debug Options ... | Update | check
'Update when running',
in
12 group
'Update Target' check only
'Watches'
14This script requires
'matplotlib' to be installed.
18matplotlib.use('TkAgg')
24import isystem.connect as ic
25from isystem.connect import IConnectDebug as ICDebug
29cmgr = ic.ConnectionMgr()
30cmgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
32debugCtrl = ic.CDebugFacade(cmgr)
35debugCtrl.runUntilFunction('main')
36debugCtrl.waitUntilStopped()
41canvas = ax.figure.canvas
44 varName = 'main_loop_counter'
45 print(
'No target variable name specified in cmd line, using default: ' + varName)
48 print(
'Drawing chart for target variable: ' + varName)
53line, = p.plot(x, lineData, animated=
True, lw=2)
56p.axis([0, 500, -2000, 2000])
60 background = canvas.copy_from_bbox(ax.bbox)
62 startTime = time.time()
66 canvas.restore_region(background)
71 main_loop_counter = debugCtrl.evaluate(ICDebug.fRealTime, varName)
72 lineData.append(main_loop_counter.getInt())
73 line.set_ydata(lineData)
80 if (time.time() - startTime) > 5:
81 print(
'Recording finished!')
85p.subplots_adjust(left=0.3, bottom=0.3)
87manager = p.get_current_fig_manager()
88manager.window.after(100, run)