From: Todd Gayley on 24 Mar 2010 05:33 At 02:46 AM 3/20/2010, =C0=EB=E5=EA=F1=E5=E9 =CF=EE=EF=EA=EE=E2 wrote: >Todd , > >Many thanks for the detailed response. Both methods are shown by you, very >interesting. > >And thanks for sending a separate copy of the message directly to me: >message appeared in the newsgroup is damaged, and part of the code from it >does not work even after the correction of obvious damage. > >I have a question on the first method. As I understand, the function >mo["FreePhysicalMemory"] >will return the value corresponding to the time of creation of the first >NETObject ('query'). Thus, it is not suitable for periodic calls on a >regular basis. >How can I get the actual value corresponding to the time of the call? Or how >can I force updating of the values? Alexey, Just re-do the entire call when you need the current values. Here is the code packaged as a function: GetMemoryData[] :== NETBlock[ Module[{query, mo}, query == NETNew["System.Management.ManagementObjectSearcher", "SELECT * FROM Win32_OperatingSystem"]; mo == First[NETObjectToExpression[query(a)Get[]]]; (# -> mo[#])& /@ {"TotalVisibleMemorySize", "FreePhysicalMemory", "TotalVirtualMemorySize"} ] ] In[10]:== GetMemoryData[] Out[10]== {TotalVisibleMemorySize -> 3143336, FreePhysicalMemory -> 1124652, TotalVirtualMemorySize -> 4444440} Todd Gayley Wolfram Research
|
Pages: 1 Prev: Probability Histogram Problems Next: Mathematica front-end very sluggish under Linux |