Put UI-thread into low-priority at startup?

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Locked
Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Put UI-thread into low-priority at startup?

Post by Guitarm » 2004-04-27 06:05

Would it be possible to put the DCPlusPlus.exe process into low-priority at startup?. Todo this with code I mean. I guess it would be possible and if anyone with better Visual C++ knowledge than myself would apply some code here I would be more than happy to try it out. In the meantime I'll try to find out how to do it myself :). I've made it a habit to manually set the process to low-priority because of the problems with UI responding upon file-refresh or re-hashing. I would like to know if this is a reasonable suggestion or not, please feel free to express what you think.

Regards
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2004-04-27 06:56

Actually I've tested this now. This might be an ugly hack but It works and I get much less disturbance on the UI from DC++. I changed from default THREAD_PRIORITY_NORMAL to THREAD_PRIORITY_IDLE in Thread.cpp and it seems to work (at least right now :) Anyway this is just a test and I don't know if this is relevant for everybody.

Regards
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 02:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2004-04-27 07:13

One thing, idle prirority is not low priority, it's lower than that.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2004-04-27 07:16

Yes, I know that. I'll be more careful with words next time :wink: I tried with different settings but IDLE worked best.
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 02:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2004-04-27 07:22

And I can't find that code in Thread.cpp (at least not in latest CVS)....

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2004-04-27 10:27

Huh?, it's 20 lines long, are you kidding me? :D Hmmm............, Well, it's a bit weird. When I double-click on DCPlusPlus.exe from explorer I get it to start in idle-priority but if I start it from menu or shortcut it starts in normal-priority....... I don't get it. Is this some default behaviour of Win OS'es?
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-04-27 19:11

So what's the upside of this? People can disable the progress bars - is there more that's sucking down CPU time? I hardly notice it on my P4, and even on my P3/866 laptop...

joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 02:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2004-04-27 23:24

Guitarm wrote:Huh?, it's 20 lines long, are you kidding me? :D
No, the word prirorty doesnät even show up in it.

Code: Select all

* GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "stdinc.h"
#include "DCPlusPlus.h"

#include "Thread.h"

#include "ResourceManager.h"

#ifdef _WIN32
void Thread::start() throw(ThreadException) {
	join();
	if( (threadHandle = CreateThread(NULL, 0, &starter, this, 0, &threadId)) == NULL) {
		throw ThreadException(STRING(UNABLE_TO_CREATE_THREAD));
	}
}

#else
void Thread::start() throw(ThreadException) { 
	join();
	if(pthread_create(&threadHandle, NULL, &starter, this) != 0) {
		throw ThreadException(STRING(UNABLE_TO_CREATE_THREAD));
	}
};
#endif
/**
 * @file
 * $Id: Thread.cpp,v 1.6 2004/01/04 17:32:47 arnetheduck Exp $
 */

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2004-04-28 03:34

Ha, what takes CPU is I/O and search-reply. Atleast if you have a large amount of files. ;))

)trust-me-i-know-ly'ers(
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2004-04-28 03:44

GargoyleMT wrote:So what's the upside of this? People can disable the progress bars - is there more that's sucking down CPU time? I hardly notice it on my P4, and even on my P3/866 laptop...
Actually, I don't quite agree with you on this one. I notice, not a big, but noticeable difference on my Athlon XP 1800+. I most often have alot of apps running at the same time and, as been discussed before, the most noticeable problem, at least for me, has been the affect of the UI (kinda natural in a graphical env. btw). But, of course, this is just a test and I just want to know peoples opinion. Thank you for yours :)
No, the word prirorty doesnät even show up in it.
Joakim, if you're not kidding this time I get a bit scared......... :wink:
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 02:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2004-04-28 08:58

THe only place int the whole source that THREAD_PRIORITY_NORMAL shows up is in Thread.h is what I can find after a few searches. Perhaps you meant that file?

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2004-04-28 12:38

GargoyleMT wrote:So what's the upside of this? People can disable the progress bars - is there more that's sucking down CPU time? I hardly notice it on my P4, and even on my P3/866 laptop...
ivulfusbar wrote: Ha, what takes CPU is I/O and search-reply. Atleast if you have a large amount of files. ;))
Ok, ok I give up, well you're right, it doesn't make much of a difference.
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2004-04-29 05:13

Wow......ok, we can forget about this thread....... I fixed my comp, upgraded a few drivers, went from PIO to DMA, upgraded BIOS.....Well, this is a new machine :) , So guys, thanks for answering my stupid questions anyway (I'ts thanks to DC++ and you I got the machine updated).
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-04-29 21:37

Sweet. I wonder how many other people have their drives in PIO mode and don't have the latest IDE drivers (at least). I hope that's the only source of all the complaints about hashing.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2004-04-30 01:51

Oh, I think there's lot'sa people who even don't know about this. I mean, I had to sniff the internet to get a hold of all the latest drivers for just about anything in the machine. What made the biggest difference was the latest ALi drivers for the disks of course. But I'm not in heaven all the way.......I still think that there's room for improvement of the hashing algo but that's another q.
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

Locked