Page 2 of 2 <12
Topic Options
#75845 - 2003-07-15 04:51 PM Re: Memory() Testing
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Richard,

Would you mind posting the value in "HKEY_LOCAL_MACHINE\hardware\resourcemap\system resources\physical memory"? Its a long line of hex... maybe once you get to 4gigs the values change in some of the other "fields".

Also, noticed you have the version with the decimal places... the top most post is the latest and greatest version... you might try that one too.

Top
#75846 - 2003-07-15 04:52 PM Re: Memory() Testing
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#75847 - 2003-07-15 06:13 PM Re: Memory() Testing
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
[Frown] Sorry guys at home now, not back at work until Thursday.

Sorry Rich

Top
#75848 - 2003-07-23 01:04 AM Re: Memory() Testing
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Glen, Rich (or anyone with access to 4GB pc)

Would either of you mind posting the value in
"HKEY_LOCAL_MACHINE\hardware\resourcemap\system resources\physical memory\.Translated" for a machine with 4GB. Out of curiousity I would like to see if I can figure out what is wrong.

Top
#75849 - 2003-07-25 01:57 PM Re: Memory() Testing
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Al

I'm out of the loop on this for now. I came back to work and found that a "no change" policy had been placed in effect because this quarter's uptime goal is already in jeapordy. Further, the QA servers that I thought I'd be able to test on had an application change - app changes are exempt - and are now crashing every 10-15 minutes. Apparently we aren't concerned if the client trashes their own availability [Wink]

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#75850 - 2004-02-03 12:52 AM Re: Memory() Testing
NTDOC Administrator Offline
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
#75851 - 2004-02-03 12:54 AM Re: Memory() Testing
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
If you do get it working I'd like to request that it support the following.


SetOption('NoVarsInStrings','ON')

Top
#75852 - 2004-02-03 06:46 AM Re: Memory() Testing
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
I'm on it - already modified to support Explicit and NoVarsInStrings. Will be testing it on large mem model servers tomorrow. Just got a 6G server and will test there before it goes into production.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#75853 - 2004-02-03 01:44 PM Re: Memory() Testing
Lonkero Administrator Offline
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
#75854 - 2004-02-03 01:49 PM Re: Memory() Testing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh, this should work to 4G
it's a matter of win32 32-bit stuff, you know.
m'kay.
_________________________
!

download KiXnet

Top
#75855 - 2004-02-03 03:39 PM Re: Memory() Testing
Allen Administrator Offline
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
#75856 - 2004-02-03 04:52 PM Re: Memory() Testing
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Might be caused by integer overflow due to being a too large number, thus continuing in the negative number space.
_________________________
There are two types of vessels, submarines and targets.

Top
#75857 - 2004-02-03 05:12 PM Re: Memory() Testing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
indeed, the above failed.
also does fail the posted udf that (as said) has limit of 4G
calculating manually with same logic gave only 4700M
_________________________
!

download KiXnet

Top
#75858 - 2004-02-03 05:19 PM Re: Memory() Testing
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Sorry for the confusion. I'm having troubles with your udf with only 512MB. It just errors out saying "Unexpected Command".
Top
#75859 - 2004-02-03 05:59 PM Re: Memory() Testing
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
I have it working - have tested it on 256, 512, 1024, 2048, 2304, 4096M systems, and using the HexDump that NTDoc posted, all with correct results. I'll post the code shortly.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#75860 - 2004-02-04 05:26 AM Re: Memory() Testing
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
OK - there is a new UDF posted to cover this topic.

The Memory UDF gathers the information from a local or remote system and parses the data.

This URL has been tested on systems with various memory configurations, including a server with 5.5 and 6.0 Gig of RAM, as well as workstations with as little as 128M RAM. (Don't have anything smaller or larger to test further).

Use is pretty simple:
Code:
 

break on

$=setoption('WrapAtEOL','on')
$=setoption('Explicit','on')
$=setoption('NoVarsInStrings','on')

' Tinman: ' memory('Tinman') ? ; Remote System
' local: ' memory() ? ; Local PC



All values are returned in Megabytes. Since only one registry read is needed, this should function prety quickly even over a WAN link.

Glenn


Edited by Glenn Barnas (2004-02-04 02:03 PM)
_________________________
Actually I am a Rocket Scientist! \:D

Top
#75861 - 2004-02-04 07:02 AM Re: Memory() Testing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
heh.
your hex solution is kinda weird and got laughted at.

alpo, sure it says.
I didn't bother fixing the above when the real one is on UDFlib (tm)

_________________________
!

download KiXnet

Top
#75862 - 2004-02-04 01:08 PM Re: Memory() Testing
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
hmm - any stranger than the 5 individual UDFs posted above that didn't work?

The purpose of that UDF was to illustrate that the code above could work for converting hsx strings of arbitrary length.
_________________________
Actually I am a Rocket Scientist! \:D

Top
#75863 - 2004-02-04 01:50 PM Re: Memory() Testing
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Good job guys. I'm glad to see we got this working in both UDFs.
Top
#75864 - 2004-02-04 02:01 PM Re: Memory() Testing
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
OK - in interest of everyone's sanity, the Memory() udf has been updated to integrate Richard H.'s very elegant, fast, and efficient Hex2Dec code.

Just one question - where were all you hex-coders when the stuff above was posted?

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.11 seconds in which 0.063 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org