mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   is there a way (https://www.mersenneforum.org/showthread.php?t=1070)

crash893 2003-09-30 06:06

not being pushy but is there a time frame we might start looking for this:question:

im trying to see if i have to make a trip down to my freinds before he goes on deployment.

like i said take your time im just getting an idea of the eta:grin:


your the man:showoff:

Danath 2003-10-05 14:28

As PrimeCruncher said on 23rd of September, "The answer is so obvious it's right in front of our face". Really, it's so simple!

Any task (read: application) in Windows represents a process in memory. Therefore, the screensaver (which is also an application) is a process in the memory. Then it's not a problem to watch for this process, and when it starts just set the timer on. After the specified number of minutes, Prime95 rises its priority (or it's changed by a another program).

The screensaver parameters (screensaver's filename, timings for screensaver start-up and monitor power-off) may be shown (to the program) manually, or they may be taken from the registry. The screensaver's process name can be found using a utility like WinTop or TaskInfo (or using the Win2000 and WinXP built-in TaskManager). Note that the screensaver usually starts when you open Control Panel -> Display -> Screen Saver page (that happens if there is shown a small motion preview of the screensaver right on this page). If this is the case, just open the Taskmanager-like utility, then open the Display Properties on the Screen Saver page and watch a new process being created in the Taskmanager's window. The process's name should correspond to the screensaver's filename (e.g.: MatrixMania.scr). If you can't manage to see the screensaver running and the Taskmanager's window simultaneously, then find the screensaver's file in the Windows's folder, and that will be the process's name.

The screensaver's parameters can be found in the registry (HKEY_CURRENT_USER\Control Panel\Desktop; also in: HKEY_USERS\.DEFAULT\Control Panel\Desktop). The screensaver's filename can be also found (in Win 95/98) in the file named "system.ini" (look in the Windows folder), at the end of the [Boot] section.

I suggest Mr. Woltman implements in Prime95 a function, similar to PauseWhileRunning, but with an opposite effect, something like "RisePriorityWhileRunning", which will make Prime95 rise its priority when the specified process starts, and change it back when the process is terminated.
- There also should be a parameter, something like "RiseToPriority", which will state the priority to rise to when the specified process starts. Prime95 should set its priority to the priority stated by this parameter, only if this stated priority is higher than the current priority that Prime95 had at that moment (be careful not to tangle your tongue when reading this sentence :razz:). If this parameter is not present, then Prime95 sets its priority to a default value, corresponding to Normal (like 5, for example).
- Another parameter, something like "TimeToWaitTillRisingPriority", will tell Prime95 how much time it has to wait from the moment the specified process has been identified as running, till the moment Prime95 rises its priority. In our case, this parameter should have a value equal or even a little higher than the value of idle time after that the monitor goes into stand-by mode. If this parameter is not present, Prime95 rises its priority from the moment it identifies the specified process as running.
- And of course, there should be a parameter like "RisePriorityCheckInterval", which would tell the time between checkings for the specified process. If the parameter is missing, a default value should be used. I don't know how much CPU time does it take to look for a process in the memory, but I suppose that a default value of 5 minutes would be good.

So this should act as follows: the specified process (the screensaver, for example) is launched, then Prime95 identifies it as running and starts the timer; when the specified time elapses, it rises its priority to the specified (or the default) level, but not lower than the current priority level. From this moment, Prime95 permanently watches the specified process (the screensaver), and when this is terminated, sets its priority back to the level it had before it rised.

It would be good to add a function to the Prime95 program, that automatically takes the screensaver's parameters from the registry (if the user activates this feature), because the user might change the screensaver, the timings for monitor power-off, and might not change the values for the parameters in prime.ini (it's easy to imagine a situation like: the screensaver starts after 10 mins, the monitor goes to stand-by mode after 40 mins, and Prime95 is setted to rise its priority to 7 after 10 mins from the screensaver's start; the poor user might have a heart-ache watching his screensaver (on his powerful computer!) trying to render some animation :shock: ).

I hope I haven't bored you with this post :unsure:.

PrimeCruncher 2003-10-05 15:35

[QUOTE][i]Originally posted by Danath [/i]
[B]I hope I haven't bored you with this post :unsure:. [/B][/QUOTE]

On the contrary, you have an excellent idea! I agree with you and I think that would be an excellent idea to add to Prime95.

Crash893, What priority is Prime95 running at now? Rather than try to find the thread that is doing calculations for Prime95 maybe it would just be easier to lower the priority of the screensaver. Also, I need to know the filename of the screensaver. It shows up in the task manager as "whatever.scr"

Once we know what to look for and the timer value (which would be implemented as command line variables) we can then scan through the process list say, once per minute. If we find it we start the timer. The timer should check once per minute to make sure the screensaver is still running. If not, terminate the timer and go back to step one. If it is, we increment a counter and once we loop through x times we adjust the screensaver priority. Then we don't really have to worry about adjusting anything else because when there is user input again, the screensaver automatically terminates. So when our timer loop sees that the screensaver has terminated, we go back to scanning the process list again and repeat the whole process.

This method would have a major advantage over the one previously discussed in that 1) we don't have to find prime95 to adjust a thread and 2) since we don't have to adjust a thread, just a process, this would be compatible with all 9x and NT-based systems (doing research on MSDN reveals that OpenThread which you need to get a handle is only available on 2K, ME, and XP whereas OpenProcess is available on 95, 98, ME, NT, 2K, and XP).

Okay, now I'm hoping [B]I[/B] haven't bored you to death with [B]my[/B] post. :grin:

PrimeCruncher 2003-10-05 15:46

Just wanted to add a couple more things. :grin:

Actually, I don't need to know the name of the screensaver since that will be implemented as a command line argument.

We need to determine what priority Prime95 is running at from the chart posted on several pages at MSDN.

[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getpriorityclass.asp[/url]

IDLE_PRIORITY_CLASS seems to be the lowest level. If the screensaver is already running at that then we have to increase Prime95. I have a feeling Prime95 uses that same level but I'll code a test app when I have a minute to verify that.

I'd like to know how George implemented his numbering system. Is there an API call I'm missing somwhere? If, on his system, screensaver is at 4, we could set Prime95 to 3 and then when the monitor goes off bump the screensaver down to 2.

PrimeCruncher 2003-10-05 19:29

Good news everyone! After discovering that the screensaver might not be running at the priority MSDN specified, I coded a test app. It successfully found the test screensaver (the OpenGL flowerbox one) and changed its priority from Normal to Low, which is the lowest I can set it at. This results in one frame being rendered every couple of seconds, so you know Prime95 (along with any other progs running) will be getting max time possible. Still have a ways to go before I can post a version here that Crash893 can use, but at least we know its doable!

crash893 2003-10-06 17:19

[QUOTE][i]Originally posted by PrimeCruncher [/i]
[B]On the contrary, you have an excellent idea! I agree with you and I think that would be an excellent idea to add to Prime95.

Crash893, What priority is Prime95 running at now? Rather than try to find the thread that is doing calculations for Prime95 maybe it would just be easier to lower the priority of the screensaver. Also, I need to know the filename of the screensaver. It shows up in the task manager as "whatever.scr"[/B][/QUOTE]

the problem with that is the screensaver changes and quite offten
and its not under my control as stated above its for some of my teammates

if it was my comptuer i could do away with all this trouble and just not run a screen saver or run the blank screen saver but its not.

so the screen saver is a variable and how it responds is a variable

i do like the raisepority tag that we could use

could we find a way to do that with "*.scr"

PrimeCruncher 2003-10-06 19:47

[QUOTE][i]Originally posted by crash893 [/i]
[B]could we find a way to do that with "*.scr" [/B][/QUOTE]

Actually, we can. And the other good news with that would be that we can eliminate one command line parameter. Shouldn't interfere with anything else since as far as I know screensavers are the only thing that uses that extension.

As long as the monitor standby time remains the same there should be no problem.

crash893 2004-01-02 00:57

anyword on this

PrimeCruncher 2004-01-02 01:29

Sorry, all these blasted projects are keeping me busy. I have a big one due in about two weeks. Maybe after that I'll have time on the weekends. It may take a while but I [B]WILL[/B] get it done. :geek:

crash893 2004-02-03 01:32

any update on this?

PrimeCruncher 2004-02-03 02:56

Sorry Crash893, I keep getting sidetracked. Haven't had time to program a bloody thing in months. But February Vacation is coming up and I'm going to try to make a conerted effort to get this done.


All times are UTC. The time now is 05:35.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.