DEADSOFTWARE

added d_mem command
authorfgsfds <pvt.fgsfds@gmail.com>
Mon, 11 Sep 2017 17:57:11 +0000 (20:57 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Mon, 11 Sep 2017 17:57:11 +0000 (20:57 +0300)
src/game/Doom2DF.dpr
src/game/g_console.pas
src/game/g_game.pas

index 97fdb669e7c5d52616e69030f7924fada08cd8be..7f0afecda37322d78a9b6cea05b136f8eb76db40 100644 (file)
@@ -13,7 +13,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *)
-{$MODE DELPHI}
+{$INCLUDE ../shared/a_modes.inc}
 program Doom2DF;
 {$IFNDEF HEADLESS}
   {$IFDEF WINDOWS}
index 3bceba1c742bcdf4a8fbb877e38a1ebe170a9a5f..19c83b6f67c7c5ddc5269a838c295bc7643ff246 100644 (file)
@@ -613,6 +613,7 @@ begin
   AddCommand('d_health', DebugCommands);
   AddCommand('d_player', DebugCommands);
   AddCommand('d_joy', DebugCommands);
+  AddCommand('d_mem', DebugCommands);
 
   AddCommand('p1_name', GameCVars);
   AddCommand('p2_name', GameCVars);
index 05b824ac9f1f9814b59f80fd244e7436b037c116..d1ffd7ade5d35568897b3a5b825e0ec55a682da4 100644 (file)
@@ -5165,6 +5165,19 @@ begin
   end;
 end;
 
+procedure PrintHeapStats();
+var
+  hs: TFPCHeapStatus;
+begin
+  hs := GetFPCHeapStatus();
+  e_LogWriteLn ('v===== heap status =====v');
+  e_LogWriteFln('max heap size = %d k', [hs.MaxHeapSize div 1024]);
+  e_LogWriteFln('max heap used = %d k', [hs.MaxHeapUsed div 1024]);
+  e_LogWriteFln('cur heap size = %d k', [hs.CurrHeapSize div 1024]);
+  e_LogWriteFln('cur heap used = %d k', [hs.CurrHeapUsed div 1024]);
+  e_LogWriteFln('cur heap free = %d k', [hs.CurrHeapFree div 1024]);
+  e_LogWriteLn ('^=======================^');
+end;
 
 procedure DebugCommands(P: SArray);
 var
@@ -5280,6 +5293,10 @@ begin
     begin
       for a := 1 to 8 do
         g_Console_Add(e_JoystickStateToString(a));
+    end
+    else if (cmd = 'd_mem') then
+    begin
+      PrintHeapStats();
     end;
   end
     else