EiffelBase class
(HTML page generated by ISE Eiffel 4.2)
Eiffel Class
indexing
description: "Properties of the memory management mechanism. This class may be used as ancestor by classes needing its facilities.";
status: "See notice at end of class";
date: "$Date: 2007-03-30 11:10:11 -0800 (Fri, 30 Mar 2007) $";
revision: "$Revision: 95354 $"
class MEM_INFO
inherit
MEM_CONST
creation
make
feature -- Initialization
make (memory: INTEGER) is
-- Update Current for memory type.
-- Was declared in MEM_INFO as synonym of make and update.
do
mem_stat (memory);
type := memory;
total := mem_info (1);
used := mem_info (2);
overhead := mem_info (3)
ensure
type_updated: type = memory
end;
update (memory: INTEGER) is
-- Update Current for memory type.
-- Was declared in MEM_INFO as synonym of make and update.
do
mem_stat (memory);
type := memory;
total := mem_info (1);
used := mem_info (2);
overhead := mem_info (3)
ensure
type_updated: type = memory
end;
feature -- Access
type: INTEGER;
-- Memory type (Total, Eiffel, C)
feature -- Measurement
total: INTEGER;
-- Total number of bytes allocated for type
-- before last call to update
used: INTEGER;
-- Number of bytes used for type
-- before last call to update
free: INTEGER is
-- Number of bytes still free for type
-- before last call to update
do
Result := total - used - overhead
ensure
computed: Result = total - used - overhead
end;
overhead: INTEGER;
-- Number of bytes used by memory management
-- scheme for type before last call to update
feature {NONE} -- Implementation
mem_stat (mem: INTEGER) is
-- Initialize run-time buffer used by mem_info to retrieve the
-- statistics frozen at the time of this call.
external
"C | %"eif_memory.h%""
end;
mem_info (field: INTEGER): INTEGER is
-- Read memory accounting structure, field by field.
external
"C | %"eif_memory.h%""
end;
invariant
consistent_memory: total = free + used + overhead;
end -- class MEM_INFO
|