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-04 18:43

is there a way
 
to have prime kick in a higher pority after like 15 min of idle time and have to go back to porority 1 after it detects activity?

Xyzzy 2003-09-04 18:49

Changing priority will make little or no difference...

There are hundreds of things you can do that are simpler, safer and have a greater effect... (Like removing AOL!)

:(

crash893 2003-09-04 22:53

i was thinking more to combat screen savers after the monitor when into power saver mode


i am running this on a freinds comptuer and i promised that they woudnt no it was there

however he runs matrix screen saver but he also has his montiro go into standbuy after 15 min

so if you cant see the screen saver you could up the priority on prime and get some actuall work done.

Xyzzy 2003-09-04 23:20

Once the DPMS blanks out the screen I think the screensaver isn't drawn anymore...

dsouza123 2003-09-04 23:36

How soon does the Matrix screensaver kick in ?

If that ( Matrix kick in time) was known and the amount of time it (Matrix) has been running then the fifteen minutes could be known.

A more direct way is using an API call (in Prime95) or small utility that can detect if a monitor is in Standby/Shutdown that could then write/modify a text/ini file (for Prime95 to check) or directly change the process and thread priorities of a second program.

I use ATM under Win98SE and it can change the priority of Prime95 both at a process level and the two threads ( only one thread is used for the main work, the other has very little execution time ). I never change the priority from within Prime95.

So it is possible to change the priorities programmatically, but is it possible to detect a monitor going into energy saving mode(s) ?

crash893 2003-09-05 01:55

[quote="Xyzzy"]Once the DPMS blanks out the screen I think the screensaver isn't drawn anymore...[/quote]

i think its going to be the classical lights in the refredoator problem


however i know if you unplug the montior and plug it back in it will come back up from sleep and show you the screen saver

so it is my belife that it is running

i supsose all i would have to do is look at the itteration times but the comptuer is like 2 hours away



i would definelty think this woudl add some strenth to prime if there was a overide screensaver in sleep mode option in prime.

Xyzzy 2003-09-05 03:17

[quote="crash893"]
i think its going to be the classical lights in the refredoator problem[/quote]
Dude, that question has been bothering me for years...

Danath 2003-09-07 16:40

Currently I'm absolutely sure that the screensaver does continue to run when the monitor is in power-off state (at least under Win 98SE). That's how I realised this.

I was running the distributed.net's RC5 project on a desktop Celeron 900 MHz machine. On that computer the SereneSoft Aquarium screensaver was installed as the system's screensaver. These beautiful fishes take a lot of CPU's power to render (it's 3D, and this computer has integrated graphics). After some time I began to ask myself, why did the RC5 performance drop down when the computer was not used (the monitor changed to power-off mode), although the power management settings (excepting those for the monitor and hard disk) were set to "Always on"? As I noticed, while the system was not used, the RC5 crunching progress tended to reach the zero.

I thought it might be a Celeron's "feature", to slow down when the computer was not used. I even wrote to Intel's support, asking about such a feature, but didn't get a useful answer (just that "Pentium 4 with Hyperthreading" advertising-like information). I was so surprised by this behaviour also because the P4 machine I use, running Prime95, got a better performance when it was not used (later I realised, it was so because it was running a simple Windows standard screensaver, taken together with the fact, that it wasn't used by other user applications).

But when I went to bed one evening (about two weeks ago), a thought flashed through my mind: the screensaver might remain active even when the monitor is powered off by Windows! (There couldn't be another explanation.)

Next day I disabled the screen saver on both the Celeron and P4 computers. And things got to normal state: the machines were crunching faster when they were not used (the monitors were off-ed by Windows). With P4 running Prime95 I got a timing shift from 0.126 to 0.120 sec/iteration (that's almost 5% performance increase), after I turned the screensaver off!

Now I'm trying to find out, how to make the screensaver shutdown when the monitor gets into the stand-by and power-off states ('cause I'd rather let the screensaver run for those 10 mins, but I don't want to lose the CPU cycles for the screeensaver when it is not visible). :confused:

Xyzzy 2003-09-07 22:06

You could use the blank screensaver... I doubt it uses many cycles... :(

PageFault 2003-09-08 04:23

The MS screenwrecker, like their other products, is extremely primitive and intended to run at defaults compatible with a 1996 computer, i.e., a 166. There isn't any provision in the code to allow 3d stuff unless called for by an external app, as in gaming.

crash893 2003-09-08 22:29

[quote="Xyzzy"]You could use the blank screensaver... I doubt it uses many cycles... :([/quote]

yes but that would break my promise to have no noticable interferances with his comptuer

dsouza123 2003-09-08 23:53

I have been looking for code/utilities to do this ( prime95 faster when the monitor is on powersaving/standby/powerdown ).

The most direct is if prime95 could detect the monitor going into powersaving mode. I haven't found code that can accomplish that.

This would involve modifying prime95 and then only using a new version that has this functionality, so better with an external solution. :)

The external program could try to detect monitor powersaving and change the priorities of prime95 or other programs.

The next way is to detect if the screensaver is active and for how long.
There is code for that but I haven't got it to work. The how long part may be tricky unless continually checking or the start time can be determined somehow ( using an API call / or value stored in a registry entry).

Changing Prime95's and other programs priorities (process AND thread(s))from an external program is doable using existing utilities ( I do it all the time ).

Another possibility is when the monitor goes into standby/power off to stop the screensaver. ;)

There is no connection between the screen saver and the monitor going into standby. When the computer is idle for a certain amount of time an idle state is started if a screen saver has been specified it will be started after its wait time has elaped, if the energy saving specifies a wait time for the monitor to powerdown then when the wait has elapsed the monitor powers down. If the screen saver stops while the monitor is in powerdown the monitor continues in powerdown until keyboard or mouse etc activity ends the idle state.

Has anyone coded anything like this, a small utility that can detect either monitor powersaving or the screensaver running with how long it has been running then either changing process and thread priorities in other programs and or stopping a screen saver ? :question:

I am trying with MASM and Delphi, code from VB or C or C++ is usable, it can be converted.

There is still the issue of at least 2 maybe three code paths 9x ( 95, 95r2, 98, 98SE, ME), NT 4 and under, 2000 and XP. I am not really as concerned with 95 or NT 4/4-.

There are alot of PCs with 98SE, 2000, and XP so those are the major versions it has to work with.

I have easy access to 95 ( version ? ), 98SE. I may be able to get access to ME, XP home and maybe 2000.

I don't know if the PRO versus home/standard versions have any differences.

Who is interested, can help, has any ideas ?

jocelynl 2003-09-09 01:49

Perhaps you should convince your friend that screen savers are useless now a days. They were usefull with the old monochrome screen. And with the new plasma screen, you could have the same picture on for decade and it wouldn't make any difference.


Joss

crash893 2003-09-10 02:11

yea but you see he wont do it if he cant keep his computer the way it is
and i do mean exactly the way it is


with the matrix screen saver running the iterations times are up in the 9.933 area i mean there just awfull

and im sure im not the only person with this perdiciment

Complex33 2003-09-10 16:28

I have some instances of Prime95 running on machines where it only runs when the computer is not in use by a user. Under windows I simply setup a scheduled task that runs the executable when the computer is idle and stops when the computer is used again. This has the effect of making Prime95 completely transparent to the user with the side effect of losing all those cycles when the computer has a user on it. But, alas this is they way it must be. Perhaps it could be a solution for you.

:banana:

Complex33 2003-09-10 16:30

Oh and I forgot you would just set the priority to 5 or so which should be above the screen saver. Set the idle time for the scheduled task to coincide with the monitor power save mode :(

crash893 2003-09-14 22:35

i would like to know what Mr. Woltman thinks of this idea

also is there a comand line way to alter primes pority while its running?

if that was the case i could just make something else to run with it ( or try with my limited programing experinces)

QuintLeo 2003-09-15 11:09

There likely are still more computers around running NT4 than 2k. In any event, if a code path works under NT 4 or before, it *should* still work under 2k.

There are still quite a few machines running 95, though I suspect there are more running 98 or 98SE than 95 by now.

crash893 2003-09-21 23:46

bump

Prime95 2003-09-22 00:48

It looks like this system call would be part of a solution:

GetDevicePowerState

The GetDevicePowerState function retrieves the current power state of the specified device.

BOOL GetDevicePowerState(
HANDLE hDevice,
BOOL* pfOn
);


I don't know how to get the monitor's hDevice.

crash893 2003-09-22 23:04

what language?

PrimeCruncher 2003-09-22 23:19

I agree with Prime95 on the GetDevicePowerState API call, that would appear to be part of the solution. Doing some digging on MSDN, I think you can get a handle to the monitor using CreateFile (I know it sounds weird) by setting the file name as "\\.\LCD" but that only works on XP and I have no XP machines here.

In response to crash893, it should be supported in any language. I know it is in MASM because I just tried coding a test prog that would tell me whether the monitor was on or in a power-saving mode or off.

This all means one of two things:
1) It's impossible
2) The answer is so obvious its right in front of our face

Any votes?

crash893 2003-09-23 21:53

im hopeing its not option 1)


perhapse your looking at it the wrong way

mabey we could just do something to deterime if the system is idle ( i guess mouse /keyboard activity)

and then just start a timmer

so you set your screen saver to 5 min past idle and your monitor to 30 min past idle

you can just set your prime to 40 min past idle and have it crank up to pority 9 or 10 and then when it detects movement just go back to 1 or what ever setting you put in there.

PrimeCruncher 2003-09-23 23:49

^^
That could work, we could incorporate a command-line option to set the timer for x minutes. This would have to be changed whenever the screensaver kick-in is changed obviously. We could have it load on start-up then just check for WM_MOUSEMOVE messages. If it gets one, it resets the timer. If not and the timer gets to x minutes, the thread priority of prime95 is changed and the prog resumes checking for the message. If it gets one it changes the priority back to what was before.

crash893 2003-09-24 23:02

sounds good to me

PrimeCruncher 2003-09-24 23:45

OK, I'll start work on it. May be a while, sounds simple but the coding will be complex and I don't have lots of time to work on things like this nowadays :sad:

I'll get back to you ASAP.

crash893 2003-09-25 00:19

let me know if you need any thing ( i dont think my very limited programing skills will be able to help but i thought i would offer)

PrimeCruncher 2003-09-25 01:13

Do need to know one thing, which operating system is it? Some API calls only work on specific OSes so if you could tell me which OS it is for then it should work first try.

crash893 2003-09-25 02:31

the systems i want to start on frist are all xp pro sp1

but i have computers on my team 98 2k linux as well ( they are under my direct control so its not that big a deal)

Complex33 2003-09-25 02:46

My suggestion for an easy workaround for XP would be to run two instances of Prime95. One that is a service that runs at priority 1 and picks up any stray cycles it can. The second would be a scheduled task that runs when the computer is idle which runs at a higher priority of your choosing. As long as the idle timer is set to something greater than the monitor shut off the second instance will run at high priority while the screen is off and will quit once the computer is actively used by a user. Just my $0.02. :huh:

PrimeCruncher 2003-09-27 13:44

Crash893,
Sorry about the delay, still haven't begun work. My main desktop (which is my main development PC) is on the fritz and the :censored: thing is not making it easy for me to fix it. So I'm stuck on my laptop in the meantime. Hopefully I can get the stinking thing fixed and get back to you.

lunna 2003-09-27 20:39

In the Win32_DesktopMonitor WMI class there is a property named Availability which is probably the one wanted. I say "probably" because I didn't get the VBscript to work when I tried monitoring the Availability event...

[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_desktopmonitor.asp[/url]
MSDN: Win32_DesktopMonitor class

[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/monitoring_events.asp[/url]
MSDN: Monitoring WMI Events

[url]http://www.mvps.org/vbnet/index.html?code/wmi/wmidesktopmonitor.htm[/url]
An example written in VB

PrimeCruncher 2003-09-28 19:41

2 Problems with above solution:
1) Haven't done any COM programming
2) Works only on NT codebase

I'd hate to spend tons of time learning COM and then find out it doesn't work anyway...

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.

crash893 2004-02-03 18:10

[QUOTE=PrimeCruncher]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.[/QUOTE]


no rush just wanted to know the status

ive got 2 or 3 computers i can test it on as soon as its released

let me know

crash893 2004-03-01 00:19

bump

PrimeCruncher 2004-03-01 00:34

Well, as you can see, February vacation has come and gone. I got more busy than I expected. I've got a very busy schedule this month, but I'll be damned if this isn't done by the end of April!

crash893 2004-04-27 17:47

hey

so just checking up

whats the word

PrimeCruncher 2004-04-27 18:57

1 Attachment(s)
Geez... I'm as bad as Zeke! My 'soon' is less soon than his soon!

Dammit! I completely forgot... which really sucks since I did have time to work on it this vacation... you don't happen to have a time machine so I can go back and tell myself to finish it by any chance?

I wish I could say I'd have time to work on it soon, but I'd be lying if I did. I'm determined to get this done though, so it WILL get done this summer. I know I said that about April! I left the e-mail notification for your response to this thread in my in-box, so I won't forget about it!

I've attached the test program I wrote to this post. All it does is set the first process it finds that ends with ".scr" to the lowest priority. I know it works on 2000, so it should work on XP also, and I think it works on 98/ME. I realize this doesn't help much...

PrimeCruncher 2004-04-29 20:40

Okay, slight update:

Turns out the priority of a thread/process is actually a combination of two things: a priority 'class' and a priority 'value'. Prime95 is about the only application that uses the Low priority class. Unfortunately, if Prime95's priority is set to 1, this means that the screensaver still has higher priority because the screensaver has a priority value of 4.

As a result, I've changed the code so that instead of changing the priority class of the screensaver, it just kills the screensaver period. More cycles for Prime95! :banana:

Whether this will cause the monitor to come out of sleep, I don't know yet (we'll find out when I code in the timer), but I'd think not; all that's happening is a process is being killed.

PrimeCruncher 2004-04-30 18:55

Another update: I've worked in the code for the timers, but I've hit a snag with the KB/mouse hooks. In order to do a system hook (to catch all KB/mouse activity), you have to use a hooking procedure in a DLL. So I'm working out how to code a DLL now...

crash893 2004-05-01 17:54

i would like to mabey make a suggestion for another feature

is there a way to turn prime95 off while the computer is not idle

then have it kick in after it detects a lenth of idle and turn back off if it detects a break in idle?

PrimeCruncher 2004-05-01 18:22

I thought about that but such a feature really has no point. Prime95 is designed to pick up spare cycles, not interfere with normal applications. Therefore it's best to just leave it running all the time, picking up whatever cycles we can.

Danath 2004-05-02 11:26

[QUOTE]Whether this will cause the monitor to come out of sleep, I don't know yet (we'll find out when I code in the timer), but I'd think not; all that's happening is a process is being killed.[/QUOTE]

I've already tried it before. The screensaver creates a window, with the title "Screen Saver". When you terminate the screensaver's process, this window is closed, and this causes the monitor to exit the stand-by mode. That's why simply killing the screensaver is not a good way to minimize the screensaver's CPU usage.

The only way I see is lowering the screensaver's priority to minimum, and increasing the priority of Prime95 to some high value. I've encountered a problem here: Prime95 have 2 threads, and I don't know how to increase the priority of a thread, just of a process (increasing the priority of a process with more than 1 thread does nothing - the working thread continues to run at idle priority).

PrimeCruncher 2004-05-02 14:26

[QUOTE=Danath]I've already tried it before. The screensaver creates a window, with the title "Screen Saver". When you terminate the screensaver's process, this window is closed, and this causes the monitor to exit the stand-by mode. That's why simply killing the screensaver is not a good way to minimize the screensaver's CPU usage.

The only way I see is lowering the screensaver's priority to minimum, and increasing the priority of Prime95 to some high value. I've encountered a problem here: Prime95 have 2 threads, and I don't know how to increase the priority of a thread, just of a process (increasing the priority of a process with more than 1 thread does nothing - the working thread continues to run at idle priority).[/QUOTE]

In that case, we have two options:

1) I believe there is an API call you can use to send the monitor (or the computer) into a specific power state. After we terminate the screensaver process, we could use that to send the monitor back into 'sleep' mode.

2) The API calls used to get a list of running processes can also get a list of running threads. I have no idea what Prime95's threads would be called, however, which is why I haven't attempted to do this. Increasing the priority class of the Prime95 process should work though (though I realize you say it hasn't), based on this quote from MSDN:

[QUOTE]The SetPriorityClass function sets the priority class for the specified process. This value together with the priority value of each thread of the process determines each thread's base priority level.[/QUOTE]

This, however, creates another problem. We can make Prime95's priority higher, but what level do we set it to? If this was going to be running only on NT/2K/XP machines, we can set it to BELOW_NORMAL_PRIORITY_CLASS, but that level doesn't exist on 98/ME. I guess we can try setting it to normal priority class; if the threads still run at idle priority, then they should still have a lower priority than standard applications.

Danath 2004-05-08 20:02

[QUOTE]1) I believe there is an API call you can use to send the monitor (or the computer) into a specific power state. After we terminate the screensaver process, we could use that to send the monitor back into 'sleep' mode.[/QUOTE]
In this case there would be a sudden monitor awakening-and-falling asleep, that could annoy user. Take also into account that switching the monitor into stand-by mode and out of it shortens the monitor's life.

[QUOTE]2) The API calls used to get a list of running processes can also get a list of running threads. I have no idea what Prime95's threads would be called, however, which is why I haven't attempted to do this. Increasing the priority class of the Prime95 process should work though (though I realize you say it hasn't), based on this quote from MSDN:

Quote:
The SetPriorityClass function sets the priority class for the specified process. This value together with the priority value of each thread of the process determines each thread's base priority level.[/QUOTE]
The problem is that the main (working) thread has the lowest priority, and increasing the process's (class) priority doesn't increase the thread's priority even to a normal level.

It would be the best to have access to Prime95's internal priority setting option (from the command line), but there is no such a feature implemented (yet, I hope).

We could modify the prime.ini file directly, changing the value of the "Priority" parameter, but this would require restarting the client. You can stop the client running under Win2000/XP as a service using the "net stop" command, and you can stop the client running under Win98/ME by sending the WM_CLOSE message to Prime95's window, if it's not hidden, but how to close it gently if it has the "No Icon" option enabled (so it hasn't a window)? I've played with that before, and did not find a way to make (from the command line) the hidden client save its state and exit. Here is again the lack of command-line features that a program like Prime95 should have... :bounce: Also, the screensaver could kick in many times per day, so the client would be restarted frequently - at the moment when the monitor enters the stand-by mode and at its awakening (maybe it's not a problem for someone, but for me...).

PrimeCruncher 2004-05-08 21:57

Okay, new problem: we can't adjust Prime95's thread or process priorities. Believe me, I've spent the better part of two hours trying to make it work. Which just brings us back to where we were before: set the priority of the screensaver so low that Prime95's priority is higher than it. I have an idea that might work, I'll post again in a little while.

PrimeCruncher 2004-05-08 22:28

Okay, here's the scoop: I can tinker with the priority of the thread and process for the screensaver. I can set it to the lowest process priority possible (IDLE_PRIORITY_CLASS) and the lowest thread priority (THREAD_PRIORITY_IDLE). Unfortunately, at Priority 1, Prime95 uses the same settings, therefore half of the cycles go to the screensaver and half go to Prime95. Thus to get the most cycles possible, Prime95 must use priority 2 or above.

Have just discovered a slight side-effect, will look into it further...

crash893 2004-05-10 17:17

what if you had two instances of prime95

you had one set to pority 1

after x amount of idle time it would end that

and then start one that was set to poroty Y ( whatever you set it too ( 1-10)

then wen it detects it comes out of idle it kills prime95(2) and starts the other lowpority 1


im not sure how you would do it with the prime.ini but you could make two dir's

and modify the working dir to match so that the back up files match

( im just kinda of thinking out loud here ) let me know what you think

tom11784 2004-05-10 18:24

I personally just disable all my screen-savers and such things so I don't have to worry about changing prime95's priority beyond 2 which I did because I also have UD-Agent (cancer research stuff) running and setting prime95 priority to 2 gives it 95~99% cpu when idle

PrimeCruncher 2004-05-10 18:47

[QUOTE=crash893]what if you had two instances of prime95

you had one set to pority 1

after x amount of idle time it would end that

and then start one that was set to poroty Y ( whatever you set it too ( 1-10)

then wen it detects it comes out of idle it kills prime95(2) and starts the other lowpority 1


im not sure how you would do it with the prime.ini but you could make two dir's

and modify the working dir to match so that the back up files match

( im just kinda of thinking out loud here ) let me know what you think[/QUOTE]

A similar solution was discussed above and basically rejected because it would cause excessive start-up, shutdown of the Prime95 program. With two directories you'd also have to move all of the files between them when you did the shutdown/restart, which would cause excessive disk writes. Also, I don't know if doing this will be viewed as 'activity' and kick the computer out of sleep mode.

[QUOTE=tom11784]I personally just disable all my screen-savers and such things so I don't have to worry about changing prime95's priority beyond 2 which I did because I also have UD-Agent (cancer research stuff) running and setting prime95 priority to 2 gives it 95~99% cpu when idle[/QUOTE]

Again, discussed above. In fact, that's the whole point of this thread: the user of a borged PC wants to run a screensaver or he won't run Prime95, period.

Danath 2004-05-15 16:42

1 Attachment(s)
I have finally managed to set Prime95's priority programatically using the method provided by itself - through its menu. I just emulated the walking-through-menus-and-windows procedure, that the user would perform manually, using the mouse or the keyboard (Go to menu > "Advanced" > "Priority..." > Change priority > Click OK). :banana:

I've attached the program that sets the priority. If you run it without parameters, it will set the priority of Prime95 to 4, but if you provide a value in the command line (between 1 and 10, as stated in the Prime95's dialog window, used to set the priority), it will set the priority to that value.

E.g.: SetPrime95Priority 7
(you may rename the file, if you think its name is too long)

The program works as follows: it searches for a window, the title of which contains the string "Prime95", then goes through its menu, activates the "Priority..." option, then changes the text of the corresponding editbox to the value, specified in the command line (or to 4, if there is not one), and "clicks" the OK button. Therefore, it works as if you change the priority manually, using the mouse. That means that Prime95 will continue running, and will just restart the test using the new priority (you can try it manually and see how it goes). While restarting, it will save the current progress (that means writing to disk), but you can't avoid it using this method (hoping that the screensaver won't start/stop too frequently).

Notes:
1. This program will work properly even if Prime95's window is hidden (the NoIcon option is selected).
2. It will work only with GUI version of Prime95 - it won't work with NTPrime (the console version, designed to run as an NT service), because it does not have a menu; for those who use NTPrime the single solution (besides setting the thread's priority, which is harder to implement) is editing directly the prime.ini file and restarting the NTPrime service.
3. If Prime95 is not running, the program will wait one minute for the Prime95's window, then stop.
4. The program does not verify the value, provided as a command line parameter (it just passes the value to Prime95), so if you type a value, different not in the 1-10 range, Prime95 will show an error.

Thanks to the author of Sign Of Misery, the program which I used to make SetPrime95Priority. It's a powerful script editor and compiler, that has a set of commands, used for window managing, keyboard and mouse emulating, patching files, working with registry and many more. It's very simple to combine these commands into scripts, and you don't have to know WinAPI or any programming language to use it. This is not advertising (the program is freeware), I'm just enchanted by the functionality of this useful program (if you are interested, I could write more about it).

PrimeCruncher 2004-05-15 16:46

[QUOTE=Danath]Thanks to the author of Sign Of Misery, the program which I used to make SetPrime95Priority. It's a powerful script editor and compiler, that has a set of commands, used for window managing, keyboard and mouse emulating, patching files, working with registry and many more. It's very simple to combine these commands into scripts, and you don't have to know WinAPI or any programming language to use it. This is not advertising (the program is freeware), I'm just enchanted by the functionality of this useful program (if you are interested, I could write more about it).[/QUOTE]

I would absolutely like to know more about that program!

Now, a more important question: will this 'wake up' the computer if running screensaver or in monitor sleep?

Danath 2004-05-15 19:09

Firstly answering PrimeCruncher's question: since the SetPrime95Priority does not emulate the keypresses, it doesn't make the screensaver stop or monitor wake up, so it's ok. It just executes (internally) the menu commands, changes the editbox's text and sends to "OK" button a "click" message.

Now about Sign Of Misery. It was written by a Russian programmer, who names himself CyberManiac. He has a web-page ([URL]http://inqsoft.tsx.org[/URL]), Russian only. But there is also a "partner" web-page, in English: [URL]http://www.geocities.com/xmemor/2lz/s0m.html[/URL].

Currently there are available version 2.65 (with the update to 2.68) and the pre-release of version 2.7 (with the update to pre-release 2). You may choose the 2.65 (2.68) version as a stable-proved one, or go with the pre-release of 2.7 version, which has many improvements and fixes, but is still a beta. To install the update, simply unzip it into the folder where you installed S0M, replacing the old files.

The program has both Russian and English interfaces, so you can use it if you don't understand Russian, but unfortunately it doesn't have English help yet (Russian only). The help describes the commands S0M has, and is very useful if you don't understand how a certain command works, but that is - no English help available at the moment. However, most of the commands are quite intuitive, so it's not difficult to use them.

Below I attach the SetPrime95Priority script, which you can edit and compile using S0M.

[I][SIZE=1]Edit: Attachment removed due to possible virus.[/SIZE][/I]

lunna 2004-05-16 18:59

Looks like you are nearing a resolution.

One way I was thinking about would be to write a custom screensaver. Its purpose would be to start the user-defined screensaver and when the monitor goes into powersave kill the screensaver. If you want to go this route the source from distributed.net's screensaver multiplexor ([url]http://http.distributed.net/pub/dcti/source/pub-20030303.tar.gz[/url] 1.6MB, file pub-20030303/plat/win/w32ss.cpp) might be valuable. Unfortunately I won't be able to test this out myself anytime soon.

Some random links I found:

HOWTO: Force a Screen Saver to Close Once Started in Windows NT/2000/2003
[url]http://support.microsoft.com/default.aspx?scid=kb;EN-US;140723[/url]

HOWTO: Determine Whether a Screen Saver Is Running on Windows NT
[url]http://support.microsoft.com/default.aspx?scid=kb;EN-US;150785[/url]

HOWTO: Know When Your Screen Saver Starts
[url]http://support.microsoft.com/default.aspx?scid=kb;en-us;238882[/url]

DefScreenSaverProc Function
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/defscreensaverproc.asp[/url]
(if making a screen saver)

PrimeCruncher 2004-05-16 19:09

[QUOTE=lunna]Looks like you are nearing a resolution.

One way I was thinking about would be to write a custom screensaver. Its purpose would be to start the user-defined screensaver and when the monitor goes into powersave kill the screensaver. If you want to go this route the source from distributed.net's screensaver multiplexor ([url]http://http.distributed.net/pub/dcti/source/pub-20030303.tar.gz[/url] 1.6MB, file pub-20030303/plat/win/w32ss.cpp) might be valuable. Unfortunately I won't be able to test this out myself anytime soon.[/QUOTE]

The problem is that there's no way to know when the monitor goes into powersave. Writing a screensaver really wouldn't be worth the effort, especially considering that the target environment for this is a computer that randomly changes the screensaver.

[QUOTE=lunna]Some random links I found:

HOWTO: Force a Screen Saver to Close Once Started in Windows NT/2000/2003
[url]http://support.microsoft.com/default.aspx?scid=kb;EN-US;140723[/url]

HOWTO: Determine Whether a Screen Saver Is Running on Windows NT
[url]http://support.microsoft.com/default.aspx?scid=kb;EN-US;150785[/url]

HOWTO: Know When Your Screen Saver Starts
[url]http://support.microsoft.com/default.aspx?scid=kb;en-us;238882[/url]

DefScreenSaverProc Function
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/defscreensaverproc.asp[/url]
(if making a screen saver)[/QUOTE]

The only thing here that looks good is the second to last link; the others are platform-specific, which I'm trying to avoid. And the last one is for writing a screensaver, which has been proposed several times on this board and shot down every time.

lunna 2004-05-16 19:30

[QUOTE=PrimeCruncher]The problem is that there's no way to know when the monitor goes into powersave. Writing a screensaver really wouldn't be worth the effort, especially considering that the target environment for this is a computer that randomly changes the screensaver..[/QUOTE]
I believe a global message WM_SYSCOMMAND with a SC_MONITORPOWER is sent when powersave is started.

The "randomly changes the screensaver": by a program or the user changes it himself? If the latter it would only be part of the options for this yet-not-written screensaver.


[QUOTE=PrimeCruncher]The only thing here that looks good is the second to last link; the others are platform-specific, which I'm trying to avoid. And the last one is for writing a screensaver, which has been proposed several times on this board and shot down every time.[/QUOTE]
Yes it was for writing a screensaver :wink:
Will try to find some good discussions why a screensaver solution would be bad... (off searching)

PrimeCruncher 2004-05-16 19:47

[QUOTE=lunna]I believe a global message WM_SYSCOMMAND with a SC_MONITORPOWER is sent when powersave is started.[/QUOTE]

I just tried that... odd, I could've sworn I tried it before and it didn't work. But in any case that makes coding this program a whole heck of a lot easier. :smile:

[QUOTE=lunna]The "randomly changes the screensaver": by a program or the user changes it himself? If the latter it would only be part of the options for this yet-not-written screensaver.[/QUOTE]

By a program I believe, but you can ask crash893 to be sure.

[QUOTE=lunna]Yes it was for writing a screensaver :wink:
Will try to find some good discussions why a screensaver solution would be bad... (off searching)[/QUOTE]

No need, I can tell you. Basically, Prime95 is designed to capture ALL SPARE cycles and not interfere with normal operations. A screensaver kind of goes against the point.

crash893 2004-05-17 21:18

not to mention the prime95 screensaver is boreing as hell


when i said randomly changes his wallpaper i ment manualy althogh i think i have seen programs that will do it for you


is tehre anyway we could use the pre built ( run program even when useing laptop battery power) to fool it into not running and then prority 10 when we trick it into thinkits back on ac or something like that

PrimeCruncher 2004-05-17 21:38

[QUOTE=crash893]is tehre anyway we could use the pre built ( run program even when useing laptop battery power) to fool it into not running and then prority 10 when we trick it into thinkits back on ac or something like that[/QUOTE]

Maybe, but I'd rather not mess around with system settings and such. Plus that kind of eliminates this program as a possibility for people running it on laptops. I don't think we need to do that though; given that we now know we can detect when the monitor goes into powersave (and also when it comes out apparently, I coded another test app to make sure), if we can integrate the SOM script we're good to go.

crash893 2004-08-03 00:48

any update?

PrimeCruncher 2004-08-03 01:41

It's nearly done but there's still one bug I haven't ironed out. It's weird. The SOM script won't execute when I'm executing it in real-time, but when I step through it during debugging, it works fine! Trying to determine what the problem is...

PrimeCruncher 2004-08-14 18:17

Okay, after some more work, I think the SOM script just isn't working when the screensaver is running. Danath, have you tested the script while the screensaver is running?

Bundu 2004-08-16 13:37

Boy all this stuff sounds quite complex! You sound like you guys know your way round a PC.....How's this for an idea..?

Why not design a screensaver that has a timer built in? It kicks in after 5 min but the timer kills it at 30min when the monitor powers off?

Is this possible, I know nothing about programming screensavers.....

Cheers, Mark

PrimeCruncher 2004-08-16 13:43

[QUOTE=Bundu]Boy all this stuff sounds quite complex! You sound like you guys know your way round a PC.....How's this for an idea..?

Why not design a screensaver that has a timer built in? It kicks in after 5 min but the timer kills it at 30min when the monitor powers off?

Is this possible, I know nothing about programming screensavers.....

Cheers, Mark[/QUOTE]

Part of the problem is that the user of the borged computer wants his computer to stay EXACTLY the way it is or he won't run Prime95, period. Killing the screensaver kicks the computer out of 'sleep' anyway, and I also know nothing about programming screensavers.

crash893 2004-08-17 19:31

[QUOTE=Bundu]Boy all this stuff sounds quite complex! You sound like you guys know your way round a PC.....How's this for an idea..?

Why not design a screensaver that has a timer built in? It kicks in after 5 min but the timer kills it at 30min when the monitor powers off?

Is this possible, I know nothing about programming screensavers.....

Cheers, Mark[/QUOTE]

the reason being that you would have to use just 1 screen saver

the orgional insperation for the idea is my freind who enjoys the eyecandy of his new 9600 video card but also likes to help my team out

so i said there must be a way to kick prime into high gear when the montior goes into powersaver

Danath 2004-08-27 18:58

Finally I have some spare time to post here.

[QUOTE]Okay, after some more work, I think the SOM script just isn't working when the screensaver is running. Danath, have you tested the script while the screensaver is running?[/QUOTE]
If you mean the script that changes the Prime95's priority (that I attached to one of my previous posts) - yes, it works also when the screensaver is running. Note that it might not work properly if there are other windows (besides the Prime95's window), the titles of which contain "Prime95" - I guess it's understood why. Also, you can remove the first line of the script (or change it to "Enabled"), to see the messages describing the errors that could appear while executing the script.

At some moment I realised that I was wrong when I said (in one of my previous posts - #54) that terminating the screensaver will wake up the monitor. My fault is that I tried it under Win95 only (yes, I was using also such an old OS at that time). I apologize for misleading you, I should've checked it on other OSes first. :redface: Win98/2000/XP have the screensaver/monitor power management functions implemented differently from Win95, so that terminating the screensaver (either by closing its window, or by killing its process) does not cause the monitor to exit the off-state, beginning with Win98 and above. Another correction of my words: the screensaver window's title is "Screen Saver" in Win95/98, but in Win2000/XP the title depends on the screensaver.

I plan to post here a solution soon...

PrimeCruncher 2004-08-28 12:32

[QUOTE=Danath]Finally I have some spare time to post here.


If you mean the script that changes the Prime95's priority (that I attached to one of my previous posts) - yes, it works also when the screensaver is running. Note that it might not work properly if there are other windows (besides the Prime95's window), the titles of which contain "Prime95" - I guess it's understood why. Also, you can remove the first line of the script (or change it to "Enabled"), to see the messages describing the errors that could appear while executing the script.[/quote]

I might have something open with 'Prime95' in the window name, I'll check when I have a minute.

[quote]At some moment I realised that I was wrong when I said (in one of my previous posts - #54) that terminating the screensaver will wake up the monitor. My fault is that I tried it under Win95 only (yes, I was using also such an old OS at that time). I apologize for misleading you, I should've checked it on other OSes first. :redface: Win98/2000/XP have the screensaver/monitor power management functions implemented differently from Win95, so that terminating the screensaver (either by closing its window, or by killing its process) does not cause the monitor to exit the off-state, beginning with Win98 and above. Another correction of my words: the screensaver window's title is "Screen Saver" in Win95/98, but in Win2000/XP the title depends on the screensaver.[/QUOTE]

I can kill the process by searching for ".scr" easily enough. I'll see if I still have the code that does that.

crash893 2005-05-26 21:54

Its that time of the year again

any idea on this?

Xyzzy 2011-04-25 19:35

[QUOTE=Danath;29112]I've attached the program that sets the priority. If you run it without parameters, it will set the priority of Prime95 to 4, but if you provide a value in the command line (between 1 and 10, as stated in the Prime95's dialog window, used to set the priority), it will set the priority to that value.[/QUOTE]It would be helpful if someone could run a few different virus scanners on the file attached in post #62.

Thanks!

:max:

em99010pepe 2011-04-25 19:55

[QUOTE=Xyzzy;259575]It would be helpful if someone could run a few different virus scanners on the file attached in post #62.

Thanks!

:max:[/QUOTE]

No virus with ESET NOD32 Update 6070 (20110425).

Xyzzy 2011-04-25 20:27

Earlier today we received a PM about the file having a [URL="https://www.microsoft.com/Security/portal/Threat/Encyclopedia/Entry.aspx?ThreatID=-2147325945"]virus[/URL].

:max:

Batalov 2011-04-25 21:09

[SIZE=2]Corporate McAfee immediately balked:[/SIZE]

[SIZE=2]"Virus was detected in the content (virus_detected) [/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]Content contained "StartPage-IP" virus. Details: Virus: StartPage-IP; File: attachment.php; Sub File: \SetPrime95Priority.exe\SetPrime95Priority.exe; Vendor: McAfee, Inc.; Engine error code: None; Engine version: 5400.1158; Pattern version: 6327.0; Pattern date: 2011/04/25 06:40:00[/SIZE] "

sdbardwick 2011-04-25 23:20

Microsoft Security Essentials also flagged it as a trojan: "Trojan:Win32/Sapade"
DOH! Should've clicked Xyzzy's link first...

Xyzzy 2011-04-26 01:53

It is gone now.

We just realized how old this thread is!

:mike:

retina 2011-04-26 05:25

For future reference you can use [url]http://www.virustotal.com/[/url] to scan files automatically with multiple AVs.

[size=1]False positives, false negatives, oh the joy of AVs.[/size]

Christenson 2011-04-26 10:19

[QUOTE=Xyzzy;259611]It is gone now.

We just realized how old this thread is!

:mike:[/QUOTE]

One one forum I visit, we have a really cute picture for thread necromancy like this....
It's a really ugly sorceror.


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

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