Results 1 to 4 of 4

Thread: How to peek at the Event queue?

  1. #1
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to peek at the Event queue?

    I'm writing a program that uses some third-party libraries. I've noticed that my program's memory and cpu useage increases with time. The CPU goes from 1-2% to 70% overnight and the memory goes from 2% to something like 15%. I've run valgrind and except for the usual whine about Qt not freeing memory i'm not getting any warnings about the code i've written. The third-party libraries i'm using aren't discoverable.

    Could the problem be caused by events being placed on the event queue faster than they can be processed? The increasing processing of events would explain the cpu useage and the growing queue would explain the increase in memory. To test my theory i'd like to see the size of the event queue. Is there any way to do this? Calling QCoreApplication::hasPendingEvents() doesn't really tell me what i want to know since i need to see that the queue increases with size over time and in correlation to the increase in cpu and memory useage.

    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to peek at the Event queue?

    You can either set an event filter on the application object and monitor the flow of events through your program or you can tap into QAbstractEventDispatcher somehow and do the same.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to peek at the Event queue?

    I've tried installing an eventFilter on the application object and am currently waiting to see some sort of a trend with regard to the number of events per minute. I am a bit concerned however that this won't work simply because i'm still not seeing if the queue is being filled faster than it's being emptied.

    Please correct me if i'm wrong but the eventFilter only receives events as they are being dispatched from the queue, right?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to peek at the Event queue?

    Quote Originally Posted by TheRonin View Post
    I've tried installing an eventFilter on the application object and am currently waiting to see some sort of a trend with regard to the number of events per minute. I am a bit concerned however that this won't work simply because i'm still not seeing if the queue is being filled faster than it's being emptied.
    It doesn't matter. What matters is the potential increase of the number of events in the queue -- all events will be processed eventually. You can craft timer events to have marks telling you how many events have been posted into the queue between two marks as events are processed in sequence (with small exceptions but that shouldn't influence your situation).


    Please correct me if i'm wrong but the eventFilter only receives events as they are being dispatched from the queue, right?
    Yes, that's correct.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    TheRonin (8th May 2009)

Similar Threads

  1. Replies: 4
    Last Post: 19th February 2009, 11:10
  2. Custom event gets not propagated to the top level widget
    By nightghost in forum Qt Programming
    Replies: 0
    Last Post: 29th January 2009, 09:06
  3. Qt event queue overloading?
    By gct in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2008, 18:39
  4. Event Queue Question
    By TheGrimace in forum Qt Programming
    Replies: 10
    Last Post: 5th October 2007, 16:55
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.