#75846 - 2003-07-15 04:52 PM
Re: Memory() Testing
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
256 MB RAM quote:
632 - 632 15356 - 15356 237504 - 237504
232.5703125 232
Kent
|
|
Top
|
|
|
|
#75847 - 2003-07-15 06:13 PM
Re: Memory() Testing
|
Richie19Rich77
Seasoned Scripter
   
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
Sorry guys at home now, not back at work until Thursday.
Sorry Rich
|
|
Top
|
|
|
|
#75850 - 2004-02-03 12:52 AM
Re: Memory() Testing
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11628
Loc: CA
|
Al,
Even on a machine with 2GB or RAM I'm not getting the correct results. It appears to be correct for systems with 1GB or less of Memory though.
Here is the code I modified to support a remote machine.
memory('mytestserver')
Code:
function memory(optional $fTarget) dim $hexdmp, $hex, $counter, $hexvals, $memkey, $vals If ($fTarget) $fTarget = IIf("\\" = Left($fTarget,2),$fTarget,"\\" +$fTarget) + "\" EndIf $memkey=$fTarget+"HKLM\hardware\resourcemap\system resources\physical memory" $hexdmp=readvalue($memkey,".Translated") for $start = 1 to len($hexdmp) step 8 $hex="" for $counter = 0 to 7 step 2 $hex=substr($hexdmp,$start + $counter,2)+$hex next if $hexvals="" $hexvals=$hex else $hexvals=$hexvals + "|" + $hex endif next $vals=split($hexvals,"|") for $counter= 8 to ubound($vals) step 4 $nul=execute("$$memory=0.0 + $$memory + &"+$vals[$counter]+"/1024") next $memory=int(($memory +648)/1024) endfunction
|
|
Top
|
|
|
|
#75853 - 2004-02-03 01:44 PM
Re: Memory() Testing
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
k, eat this. this does not report your physical memchip-size but the total memsize in megabytes your comp sees. calculated and tested.
Function MemSize(optional $machine) dim $ if vartype($machine) $machine=join(split($machine,"\"),'') $machine="\\"+$machine+"\" endif $=right(readvalue($machine+"HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\System Resources\Physical Memory",".Translated"),8) $=execute($MemSize+"=&"+right($,2)+substr($,5,2)+substr($,3,2)+left($,2)+"/1024.0/1024.0+16") endfunction
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#75855 - 2004-02-03 03:39 PM
Re: Memory() Testing
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Lonk, I'm having troubles with your udf. I'm not sure where the problem is, but it appears to be coming from the line:
Code:
$=execute($MemSize+"=&"+right($,2)+substr($,5,2)+substr($,3,2)+left($,2)+"/1024.0/1024.0+16")
Last night DOC sent me a regdmp of the .Translated value from a box with 5.5GB. The value of $regdmp=010000000000000000000000000000000300000003010000001000000000000000d009000301000000001000000000000080efdf030 10000000000000100000000f0ff7f1536
Running it through the udf at the top of the page, it incorrectly displays 1536MB. Looking into it I found that kixtart is returning a negative value for one of the hex values: dfef8000=-537952256, when in truth dfef8000=3757015040, if you plug this into the equation, it in fact does return 55xx MB. Obviously kixtart is hitting a limit, but I thought with the 0.0 added it would make it work. Any ideas?
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1662 anonymous users online.
|
|
|