Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

ProcessSystemEvents() slowing down

$
0
0

Hello,

 

I'm facing a strange behavior of my CVI project.

The project is quite big: several timers, probably more than 50 panels, and more than 500 controls (including graphs, trees and tables).

 

I'm facing to a slow down of my project over time. Usually, it is noticeable after several hours. At some point the slow down renders Ring manipulation extremely slow: the mouse cursor highlights items after 1 or 2 seconds (!).

 

In order to measure the slow down, I changed the call to RunUserInterface() to a loop including a call to ProcessSystemEvents().

This way, I've been able to measure execution time of the ProcessSystemEvents() call using clock().

 

At program start, the execution is below 1 ms.

However, I can make it rise (I will explain later how I can do this) up to 3 ms. At that point, the execution time rises slowly over time. I haven't made precise measurement, but I would say it increases of 1 ms every 10 minutes.

 

I tried to put breakpoints at many callback functions, but I don't get any callback calls (when not doing anything), excepted in timer callbacks.

So I tried to break on ProcessSystemEvents() and then "Step Into".

I was able to confirm that I get only timer callbacks (apparently).

 

One strange thing is that I get up to 3 calls to each of my callbacks. But OK, that's CVI's internal way of doing, it's not important.

 

Anyway, it's looks like I don't get my own code executed, only timer callbacks (which I emptied) and CVI black magic.

 

So, I can only conclude that the ProcessSystemEvents() call is spending time at code I don't know.

 

Does anybody know what could happen ? Most likely I'm doing something wrong at my program start which triggers a bad behavior. If, ever, somebody has suggestions, I would be really interested.

 

 

Now, I'll try to explain what my program is doing when starting, and what I'm doing to "trigger" the slow down, or maybe only what i'm doing to "accelerate" the beginning of the slow down.

 

My program is quite big and consists of many panels which I have organized more or less in tabs.

In fact, it looks like the popular Firefox extension "Tree Style Tab".

The main panel has a tree control which lists panels. So, there is a graphic representation of the child/sibling relationship of the panels.

 

At program start, all the panels are loaded and "inserted" in this tree. Some of them are loaded several times.

I also start some timers: one is running at 1s, one is running at 1 ms (I removed almost all code inside the timer callbacks).

 

When I want to trigger the slow down, I just click on one item of this tree which then shows the corresponding panel (and hides the previous one). I then use the keyboard to navigate in the tree (and thus showing different panels).

If I navigate quickly (using keypress repeats) over all the panels I have (let's say, 20 panels in 1 second) I usually trigger the slow down as soon as I stop changing panels (sometimes I need to repeat the "navigation").

 

If I don't navigate quickly (let's say 1 panel every 2 seconds), I don't trigger the slow down (maybe it would appear hours after, I haven't tried).

If I disable the timers, I don't trigger the slow down (maybe it would appear hours after, I haven't tried).

 

Up to now, I haven't been able to remove enough code to be able to publish a simplified version of my program which triggers the slow down fast enough, but I'm still trying...

 

 

So, now that you have read up to this point (I would be truly impressed if anybody have read this far...), here are some questions which could be answered to many people (from newbies to NI experts and NI officials):

- has anybody ever seen such a behavior ?

- how could I replace the ProcessSystemEvents call with something I can trace ?

- has anybody have suggestions on how to investigate ?

- why is there up to 3 timer callback calls in 1 single ProcessSystemEvents call ?

- can my problem be related to EVENT stack explosion or something related ?

- is there any way to know what's inside the event stack ?

 

 

For information:

- I'm using CVI 2017 (but I have the problem since CVI 2012 at least, I just never had dedicated time to investigate)

- the slow down appears at different rates (unless I trigger it) on different computers

- launching the program from CVI (shift-F5) helps triggering the slow down much faster

- the slow down also appears on computer which only have CVIRTE

- I'm running windows 10, but I had the problem when I was running windows 7

 

Thanks for reading such a long and mysterious message Smiley Happy

 


Viewing all articles
Browse latest Browse all 5339

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>