| Allegro CL version 8.2 Unrevised from 8.1 to 8.2. 8.1 version | ||||||||||
Arguments: nil
Returns a property list whose keys are keyword symbols identifying information about status of memory (:percent-used, :total-physical, :available-physical, etc.) and whose values are the associated values.
This function simply links to the MS Windows function described here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp, click on the MEMORYSTATUS structure (we cannot guarantee this link will remain valid). The Lisp function source is here:
(defun memory-status ()
(declare (optimize (speed 3) (safety 1))) ; for dynamic extent
(with-stack-fobject (struct 'memorystatus)
(setf (fslot-value-typed 'memorystatus :foreign struct 'dwLength)
(ff::sized-ftype-width
(ff::iforeign-type-sftype
(get-foreign-type 'memorystatus))))
(GlobalMemoryStatus struct)
(list
:percent-used
(- 100
(/ (round
(* 100 ;; this is to round to two decimal places
(/ (* 100.0
(+ (fslot-value-typed 'memorystatus :foreign struct
'dwAvailPhys)
(fslot-value-typed 'memorystatus
:foreign struct 'dwAvailPageFile)))
(+ (fslot-value-typed 'memorystatus
:foreign struct 'dwTotalPhys)
(fslot-value-typed 'memorystatus
:foreign struct 'dwTotalPageFile)))))
100.0))
:total-physical (fslot-value-typed 'memorystatus :foreign struct
'dwTotalPhys)
:available-physical (fslot-value-typed 'memorystatus :foreign struct
'dwAvailPhys)
:total-paging (fslot-value-typed 'memorystatus :foreign struct
'dwTotalPageFile)
:available-paging
(fslot-value-typed 'memorystatus :foreign struct 'dwAvailPageFile)
:total-addressable
(fslot-value-typed 'memorystatus :foreign struct 'dwTotalVirtual)
:available-addressable
(fslot-value-typed 'memorystatus :foreign struct 'dwAvailVirtual)
:load (fslot-value-typed 'memorystatus :foreign struct 'dwMemoryLoad))))
This function is defined in the :winapi module. If
that module is not loaded, evaluate (require
:winapi). This function is available on Windows machines
only. In releases prior to 7.0, the symbol naming this function was
exported from the common-graphics package. Starting
in release 7.0, it is exported only from the
windows package. This function is available in
images into which the :winapi module has been
loaded but the Common Graphics and IDE modules have not.
Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.
| Allegro CL version 8.2 Unrevised from 8.1 to 8.2. 8.1 version | ||||||||||