#84940 - 2002-01-24 02:44 AM
How do I throttle back the CPU on a script?
|
cj
MM club member
   
Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
|
Here is the code:code:
$dirs=dirplus("\\@wksta\users$$", "*.*", 1, 0)for each $sFilename in $dirs ; $sFilename=$oDirFile.ReadLine() ; read filename from list $oFile=$oFS.GetFile($sFilename) ; get time/date of this file if not @error $sDate=split($oFile.DateLastAccessed(), " ")[0] ; capture the date part of this time/date info $saDate=split($sDate, "/") ; split the date into it's parts for checker if DateMath(@date, $saDate[2]+"/"+$saDate[1]+"/"+$saDate[0])>$iCheckAge ; check date against today $sUser=split($sFilename, "\")[4] ; capture the user name from the path $sFilename="H:\"+right($sFilename, len($sFilename)-len($sUser)-17) ; capture the filename $sDate "," $sUser "," $sFilename ? ; display to screen > csv file endif endif next
Here is the DIRPLUS UDF The UDF averages 50% cpu then when the For Each kicks in, bang 100% flat line. I could put a sleep 1 in there, sure, but when are looking at 115000 array elements, that would make this 2 hour script take an extra 32 hours! I would be happy to make it take 4 hours if it would keep to 50% CPU. Any ideas? cj
|
|
Top
|
|
|
|
#84943 - 2002-01-24 02:04 PM
Re: How do I throttle back the CPU on a script?
|
Alex.H
Seasoned Scripter
Registered: 2001-04-10
Posts: 406
Loc: France
|
cj, maybe try to run this one with : start /low /wait Kix32.exe .... Even if cpu is to the max, other process will got everything they need
_________________________
? getobject(Kixtart.org.Signature)
|
|
Top
|
|
|
|
#84951 - 2002-01-25 11:04 AM
Re: How do I throttle back the CPU on a script?
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
I quess bryce ment something like: http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=002030 as, in bgi.ticks() but don't know if this is what he really ment... but as I see it, this could be easily included in kix-dll's cheers,
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#84955 - 2002-01-25 01:49 PM
Re: How do I throttle back the CPU on a script?
|
Alex.H
Seasoned Scripter
Registered: 2001-04-10
Posts: 406
Loc: France
|
Lonkero, This one is an API command, and so can't be called from command line. On the other hand, maybe it's the one Ruud use actually, but with dwMilliseconds * 1000
_________________________
? getobject(Kixtart.org.Signature)
|
|
Top
|
|
|
|
#84959 - 2002-02-05 01:57 PM
Re: How do I throttle back the CPU on a script?
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
Lonkero,It is a pseudo API call. Meaning that you are attempting to call a function within a dll from the rundll program. This link will explain why you can't call it from a command line. The Win32 Rundll and Rundll32 Interface Note the line that says: you can not use these utility programs to call the Win32 API (Application Programming Interface) calls exported from the system DLLs However, this should be VERY easy to implement within the KIX executable from everything I see on the net. Hope this helps [ 05 February 2002: Message edited by: NTDOC ]
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 811 anonymous users online.
|
|
|