-
CPU Usage so high
I was wondering how I could lower the CPU Usage of my program, currently the program only has a layout and no actual working code but it uses my CPU at 60%.
Is this normal? But i was trying this with other programs such as Windows media player and its CPU Usage was 2%.
I have no timers or loops in my program just the butons and the form, and i have no idea why it uses my CPU so much.
-
60% :eek: !!
What compiler?
Can I see some of your code? I mean, my application I'm making is filled with wrappers for most of my controls and subclasses for heaps of controls and I get a max of 4% usage and that takes a lot of stuff to do that.
What processor do you have? How much ram?
-
Compiler: MSVC++ 6
Processor: 3 Ghz Pentium 4
Memory: 1024 mb ram
and the code was messy (i dont know how to add tabs to make my code look neat with code tags lol) to add on this so im going to attach it
-
Nice system :) ... Well with specs like that it shouldn't make a hit when it's just idle.
[edit:] Well there is nothing in your code that should make it go that high when you aren't actually doing anything with it.
If however you are say, typing and clicking buttons and stuff 60% is not to hard to reach although even on my system (2.8Ghz) I only hit 38%, but then again my system is different because of my massive cooling.
Is it very hot? Maybe you have a cooling problem, the closer to super conductivity the faster the system and less constant load.
-
Well im sure its not cooling lol 4 fans usually at a constant 30 celcius or less :) but it maybe the fact that i use peekmessage instead of getmessage, i just read a post about how it uses more of the CPU and lol why would i click useless buttons :) its 60% in idle, im going to try and use WaitMessage() before PeekMessage and maybe itll workout
Thanx for the help though, Mithoric
-
Well i fixed it and achieved 0% usage but it kinda sux, it paints slower and stuff, ill just switch to GetMessage i suppose, but the thing is I need the program to accept data from clients through winsock and I have NO idea how to implement it, so Im not really sure what to do
Do you know how to implement a basic server to client program? into the code i already posted
-
Sure, creating that is pretty simple. Here is a great winsock tutorial!
http://www.hal-pc.org/~johnnie2/winsock.html
-
dude this site is perfect, has tutorial and the code, THANX MAN!! you saved my life like twice now lol keep it up!
thanx again mithoric
-
just 1 question, does the code on his site support multiple clients to 1 server? I really dont know lol i just switched over from VB a couple of months ago and I've never used winsock until now so its all a bit blurry
-
Hmm.. I'm not quite sure about that, I'll have to investigate.