Results 1 to 3 of 3

Thread: Erratic performance of IO operations in Qt4 program

  1. #1
    Join Date
    Dec 2009
    Posts
    24
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Erratic performance of IO operations in Qt4 program

    Hi,

    Somewhere in a qt4 program, I launch a thread, that will do some IO operations in a file...
    I'm trying to time this operation...
    Qt Code:
    1. t.start();
    2.  
    3. SegDIO_getRMS(mFilename.data(), mSegdAttributes->averaged, mSegdAttributes);
    4.  
    5. qDebug("Time to extract datasquare: %d ms", t.elapsed());
    To copy to clipboard, switch view to plain text mode 

    all three parameters of the function SegDIO_getRMS are pointers... (to char*, float* and pointer to a custom struct....)

    Now there is a timer also in the called function, wrapping all operations...

    At the beginning, the 2 timers are in agreement... everything's as fast as it should...but after some time,
    the outside time is reporting times that are 5 times bigger than the inside timer...

    Unless I'n not understanding something properly , the only operations made between these 2 timers are
    locating the position in memory of the function and copy 3 pointers to it... that is reported during almost a full second...
    which makes no sense...

    I'm out of ideas of how to diagnostic the problem...

    Does somebody has an idea of what's going on?

    EDIT: additional info:
    monitoring the I/O with iostat confirms that something goes to hell when timing become inconsistent :
    Qt Code:
    1. Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
    2. sda 26.50 232.00 16.00 464 32
    3. sr0 0.00 0.00 0.00 0 0
    4.  
    5. Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
    6. sda 14.50 120.00 16.00 240 32
    7. sr0 0.00 0.00 0.00 0 0
    8.  
    9. Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
    10. sda 1578.50 30748.00 0.00 61496 0
    11. sr0 0.00 0.00 0.00 0 0
    12.  
    13. Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
    14. sda 3230.50 63684.00 28.00 127368 56
    15. sr0 0.00 0.00 0.00 0 0
    To copy to clipboard, switch view to plain text mode 
    Last edited by jcox23; 26th January 2010 at 15:26.

  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: Erratic performance of IO operations in Qt4 program

    The process is probably preemptied by the kernel somewhere inbetween reading the two timers so the second timer is delayed by the amount of time your process was sleeping. I wouldn't worry about it, especially that using QTime for benchmarking is unreliable anyway. Use QBENCHMARK instead and see if you get consistant results (note though that you can't nest calls to QBENCHMARK).
    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
    Dec 2009
    Posts
    24
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Erratic performance of IO operations in Qt4 program

    Quote Originally Posted by wysota View Post
    The process is probably preemptied by the kernel somewhere inbetween reading the two timers so the second timer is delayed by the amount of time your process was sleeping. I wouldn't worry about it, especially that using QTime for benchmarking is unreliable anyway. Use QBENCHMARK instead and see if you get consistant results (note though that you can't nest calls to QBENCHMARK).
    Thanks for pointing out QBENCHMARK...I didn't know QTime was not appropriate....

    Also, I discovered that I may have benefited from a generous OS caching policy ... testing on the same series of files all the time and having 12Gb of RAM, I would assume the OS (ubuntu 8.04 64 bits here) would cache those files in memory...

    After a computer restart, the timings I get are systematically the ones I thought were slow...

Similar Threads

  1. Multithreaded per pixel operations on QImage
    By N¤X in forum Qt Programming
    Replies: 8
    Last Post: 14th September 2009, 12:29
  2. String operations, printing to stdout
    By Cruz in forum Newbie
    Replies: 3
    Last Post: 20th January 2009, 15:30
  3. Replies: 7
    Last Post: 19th January 2008, 15:29
  4. How to manage QSqlTableModel database operations?
    By Abk in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2007, 10:44
  5. Graphics operations - Qt 4.1
    By hoborg in forum Newbie
    Replies: 1
    Last Post: 18th February 2006, 14:09

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.