flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2, 3 Next |
Author |
|
ds316 22 Jan 2007, 07:51
Hi all,
A few days ago I got fed up with Vista RC1 lagging on my 512 MB machine. So I thought maybe I could force windows into behaving as I thought it should. So, I wrote Sparky8. It's a very very small win32/win64 app that runs itself with Realtime priorities and monitors what application you are using and boosts its priority to high, and when you switch away from that application, its priority goes back to normal. My friends Core 2 Duo E6600 OC'ed to 3.2 GHz with 2 GB of RAM even saw an immediate improvement in system responsiveness. Sparky8 is available in both a 32-bit and 64-bit version, although a 32-bit version will work perfectly fine on 64-bit version of windows (ie can still boost priority of x64-based apps). On Windows Vista RC1 x64 with 1 GB of RAM (I upgraded) it uses only 300-400 K of system memory and after 10 hours it hadn't even consumed one second of CPU time. Seriously recommended, written of course in FASM, source code included in the download: http://www.virtual-nation.net/node/6 Any comments, recommendations would be nice. Note: Don't comment on the efficiency of my code too much, and I know there is a not entirely necessary line of code where Sparky8 will constantly check its priority to see if it is still realtime. This is because when Windows starts up apps it forces them to run with a below normal priority, until windows has finished booting then it gets its normal priority. Using the code the way I have just keeps it running at realtime even then, and it running at realtime is actually very important to the way it operates. |
|||
![]() |
|
vid 22 Jan 2007, 08:43
just wondering: how exactly do you perform "monitors what application you are using"? topmost window, running time, or what?
nice idea, by the way |
|||
![]() |
|
vid 22 Jan 2007, 12:04
Quote: If the foreground app enters a compute-intensive eternal loop, you're screwed. |
|||
![]() |
|
f0dder 22 Jan 2007, 15:15
Hm, I read it as realtime...
but 'high' can be bad enough ![]() |
|||
![]() |
|
Raedwulf 22 Jan 2007, 20:03
i await reactos to enter usable state
![]() |
|||
![]() |
|
rugxulo 22 Jan 2007, 21:49
Sounds great! but ...
deathshrimp316 wrote:
I seriously have created user accounts at way too many websites. It's annoying to have to remember all those usernames and passwords. ![]() P.S. f0dder, ![]() |
|||
![]() |
|
ds316 27 Jan 2007, 09:46
Ah, forgot I made users login.
I suppose for the good folks here I can attach it to my post. ![]() As for 'bad-idea on single-core systems', I had it running prime95 at a high priority (apps are boosted to high-priority) and it was still very responsive. I even ran my own program which just goes label: some random instructions jmp label once it has loaded. And there was no change in responsiveness. If however, I went to realtime then yes I do understand your concern as I have a few benchmarking programs I've written that run at realtime and while they are running the computer is 100% unusable. Sparky8 itself does however run at realtime. It uses GetForegroundWindow and GetWindowThreadProcessId in user32.dll to determine the process that is in the foreground. I'm running a single-core celeron 3.06 GHz and I've never had trouble with apps actually slowing down the system while sparky8 is running. The boost that windows gives by default is negligible and might as well not be there, can still take seconds for Windows to redraw the window contents if you've got things running in the background. A simple way to test its effectiveness is to encode DVD, compress files and any other CPU intensive tasks you can think of then try opening apps and switching windows - without sparky8 this can become annoying and slow, but with sparky8 it only takes a maximum of 50 ms for the app to have higher priority than everything else. As for Vista being shit, I am running RC1, and the responsiveness is fairly on par with XP, just a little lower when both have 512 MB. With 1 GB they are pretty much the same, but both can still be boosted with Sparky8. The Core 2 Duo that still was boosted with sparky8 was running XP Pro, as sparky8 boosts XP just as well as Vista. And I would assume that it boosts 95/98/Me/NT as it should in theory work on those, but it has not at all been tested on those OS's Last edited by ds316 on 31 May 2007, 11:50; edited 1 time in total |
|||
![]() |
|
ds316 31 Jan 2007, 10:14
I'll be doing some more development on this in the next couple of days, most importantly adding in the feature that will prevent 2 copies of Sparky8 running at the same time.
Of course, don't forget to post your own results of how Sparky8 is performing on your computer. I would ask that everyone who downloads this posts a comment if possible, as the more feedback I get the more I can improve this. |
|||
![]() |
|
rugxulo 13 Mar 2007, 10:59
ds316, I haven't run it much lately because (believe it or not) I haven't been able to perceive much of an improvement. Is there an easy way to find out how much time I'm supposedly saving??
![]() |
|||
![]() |
|
white_wight 13 Mar 2007, 16:47
ds316 wrote:
Somewhere in your data section Code: _mutex_name db 'Sparky8 is already here',0 At the beginning of your code section goes Code: invoke CreateMutex,NULL,FALSE,_mutex_name invoke GetLastError cmp ax,ERROR_ALREADY_EXISTS je exit P.S. for x86 |
|||
![]() |
|
vid 13 Mar 2007, 17:13
white_wight:
you should check for error this way: Code: invoke CreateMutex,NULL,FALSE,_mutex_name test eax, eax jne okay invoke GetLastError cmp eax,ERROR_ALREADY_EXISTS je exit jmp other_error okay: because: 1. CreateMutex is not quaranteed to change value of last error to 0, when it succeeds. Remember GetLastError gets last error that happened, not last return status. 2. CreateMutex can fail for other reasons than ERROR_ALREADY_EXISTS, you should always think of this |
|||
![]() |
|
LocoDelAssembly 13 Mar 2007, 17:18
CreateMutex documentation wrote: Return Values Better use Code: invoke CreateMutex,NULL,FALSE,_mutex_name invoke GetLastError test eax, eax jnz exit That way you handle ERROR_ALREADY_EXISTS and unexpected errors at the same time. |
|||
![]() |
|
vid 13 Mar 2007, 17:35
Loco: read it again and carefully.
![]() |
|||
![]() |
|
white_wight 13 Mar 2007, 18:23
vid wrote:
Example maybe? ![]() You see, vid, in this particular case there is made a check for a specific error and i don't care why CreateMutex may fail and if it fails at all (i care only of this specific error); and the mutex is used (again, in this particular case ![]() So if you know how other error check(s) would be useful here, i'm all ears ![]() LocoDelAssembly: as vid mentioned already, be sometimes paciente not only loco ![]() |
|||
![]() |
|
vid 13 Mar 2007, 21:24
Quote:
In WinAPI everything can fail unless MSDN states otherwise (and even then sometimes...) If you want example, just think about it a little. CreateMutex for sure has to allocate some bit of memory. Allocation may fail. Another example is directly in MSDN description of function ( http://msdn2.microsoft.com/en-us/library/ms686927.aspx): Quote: However, if the caller has limited access rights, the function will fail with ERROR_ACCESS_DENIED and the caller should use the OpenMutex function. MS even gives you example how to use CreateMutex: http://msdn2.microsoft.com/en-us/library/ms686927.aspx Quote: So if you know how other error check(s) would be useful here, i'm all ears |
|||
![]() |
|
f0dder 13 Mar 2007, 22:49
List to vid and stop writing crappy code. 'nuff said.
|
|||
![]() |
|
LocoDelAssembly 13 Mar 2007, 23:08
vid, I read it as
Quote: Return Values Quote:
And I prefer to handle this way because if the "unexpectable error" occurs I must exit because I failed to check the existence of an existing instance and I don't want to continue because maybe another instance already exists. Also note that I wrote the post before your post and when I saw my last preview I saw that you posted but I was too lazy to point that out ![]() Last edited by LocoDelAssembly on 14 Mar 2007, 00:05; edited 1 time in total |
|||
![]() |
|
f0dder 13 Mar 2007, 23:20
On my system (XP SP2) CreateMutex does clear lasterror on success, but I don't see this guaranteed in MSDN. Just write proper code, it's not like it's a big fucking deal to do. If you don't care about the particular error, drop the GetLastError call and abort if CreateMutex returns 0.
|
|||
![]() |
|
LocoDelAssembly 13 Mar 2007, 23:59
And where is the backward compatibility??
My quote was extracted from http://win32assembly.online.fr/files/win32api.zip says very explicitly that LastError will be set to 0 on success. Now programs that trusted on this could become buggy in the future? PS: I will edit my previous post to make it a little bit more clear. |
|||
![]() |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.