Parcourir la source

introduced a command for inspection of free Heaps space

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6803 8c9fc860-2736-0410-a75d-ab315db34111
eth.morozova il y a 9 ans
Parent
commit
2d1123fa12
1 fichiers modifiés avec 12 ajouts et 1 suppressions
  1. 12 1
      source/SystemTools.Mod

+ 12 - 1
source/SystemTools.Mod

@@ -1,7 +1,7 @@
 MODULE SystemTools; (** AUTHOR "TF"; PURPOSE "Access to System Functions"; *)
 
 IMPORT
-	Machine, Modules, Objects, Commands, Options, ProcessInfo, Kernel, Streams, Dates, Strings, Plugins, Files, SystemVersion;
+	Machine, Modules, Objects, Commands, Options, ProcessInfo, Kernel, Streams, Dates, Strings, Plugins, Files, SystemVersion, Heaps;
 
 CONST
 	MaxTimers = 16;
@@ -351,6 +351,17 @@ BEGIN
 	END;
 END ShowStack;
 
+(** Inspect free Heaps space *)
+PROCEDURE Watch*(context : Commands.Context);
+VAR total, free, largest: SIZE;
+BEGIN
+	Heaps.GetHeapInfo(total,free,largest);
+	context.out.String("Heaps: total="); context.out.Int(total,0);
+	context.out.String(" bytes; free="); context.out.Int(free,0);
+	context.out.String(" bytes; largest free block size="); context.out.Int(largest,0);
+	context.out.String(" bytes");
+END Watch;
+
 (* Changes the extension, Usage: RenameExtension extFrom extTo~ *)
 PROCEDURE RenameExtension*(context : Commands.Context);
 VAR