From 69e1c288d6d270abd835cde8a87e818d0298799f Mon Sep 17 00:00:00 2001 From: fgsfds Date: Mon, 11 Sep 2017 20:57:11 +0300 Subject: [PATCH] added d_mem command --- src/game/Doom2DF.dpr | 2 +- src/game/g_console.pas | 1 + src/game/g_game.pas | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/game/Doom2DF.dpr b/src/game/Doom2DF.dpr index 97fdb66..7f0afec 100644 --- a/src/game/Doom2DF.dpr +++ b/src/game/Doom2DF.dpr @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . *) -{$MODE DELPHI} +{$INCLUDE ../shared/a_modes.inc} program Doom2DF; {$IFNDEF HEADLESS} {$IFDEF WINDOWS} diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 3bceba1..19c83b6 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -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); diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 05b824a..d1ffd7a 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -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 -- 2.29.2