[Bug 36692] New: Bad performance when combineng SetEvent / WaitForSingleObject for synchronizing worker threads

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Jun 7 13:52:52 CDT 2014


http://bugs.winehq.org/show_bug.cgi?id=36692

            Bug ID: 36692
           Summary: Bad performance when combineng SetEvent /
                    WaitForSingleObject for synchronizing worker threads
           Product: Wine
           Version: 1.6.2
          Hardware: x86-64
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: kernel32
          Assignee: wine-bugs at winehq.org
          Reporter: milasudril at gmail.com

In a 2d simulation program, each worker thread has its own pair of events. One
event is used to signal master thread that the worker thread is ready. The
other is used by the master thread to signal that the worker thread may
continue.

In Master thread:

    while(!m_stop)
        {
        auto proc_ptr=processors.begin();
        while(proc_ptr!=processors.end())
            {
         // Call SetEvent on "start" event object owned by the object pointed
         // to by proc_ptr
            proc_ptr->frameNext();
            ++proc_ptr;
            }
        proc_ptr=processors.begin();
        while(proc_ptr!=processors.end())
            {
         // Call WaitForSingleObject on "ready" event object owned by 
         // the object pointed to by proc_ptr
            proc_ptr->wait();
            ++proc_ptr;
            }

        ++framecounter;
        }


In worker thread:

    while(!m_stop)
        {
     // Wait for master thread signaling start event (Calls
WaitForSingleObject)
        start.wait();

        m_model->process(m_framecounter,m_buffers[0].first
            ,m_buffers[0].second,m_offset);
        swap(m_buffers[0],m_buffers[1]);

     // Signal master thread that we are ready for next frame (Calls SetEvent)
        ready.set();
        }

On Wine, the framerate is half of that on Windows 7 on the same machine
Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz. Also there seems to be a huge
different workload on differnt cores when running under Wine.

I realize that SetEvent/WaitForSingleObject are heavy functions on Windows too
as they need kernel assistance, so it might be hard to make it perform better.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list