Skip to content

Commit 5e23500

Browse files
committed
gameserver: add gameserver.ApproximateProcessMemoryUsage
1 parent 1a876ae commit 5e23500

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3242,6 +3242,10 @@ gameserver.BroadcastMessage(5, "NET_SetConVar", bf) -- 5 = net_SetConVar / net m
32423242
#### number gameserver.CalculateCPUUsage()
32433243
Calculates and returns the CPU Usage.
32443244

3245+
#### number gameserver.ApproximateProcessMemoryUsage()
3246+
Approximates the memory usage of the server in bytes.
3247+
It isn't really related to the gameserver itself, but since it has CalculateCPUUsage I want to keep them close.
3248+
32453249
### CBaseClient
32463250
This class represents a client.
32473251

source/modules/gameserver.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,12 @@ LUA_FUNCTION_STATIC(gameserver_CalculateCPUUsage)
12571257
return 1;
12581258
}
12591259

1260+
LUA_FUNCTION_STATIC(gameserver_ApproximateProcessMemoryUsage)
1261+
{
1262+
LUA->PushNumber(ApproximateProcessMemoryUsage());
1263+
return 1;
1264+
}
1265+
12601266
extern CGlobalVars* gpGlobals;
12611267
static ConVar* sv_stressbots;
12621268
void CGameServerModule::LuaInit(bool bServerInit)
@@ -1304,6 +1310,7 @@ void CGameServerModule::LuaInit(bool bServerInit)
13041310
Util::AddFunc(gameserver_SetPassword, "SetPassword");
13051311
Util::AddFunc(gameserver_BroadcastMessage, "BroadcastMessage");
13061312
Util::AddFunc(gameserver_CalculateCPUUsage, "CalculateCPUUsage");
1313+
Util::AddFunc(gameserver_ApproximateProcessMemoryUsage, "ApproximateProcessMemoryUsage");
13071314
Util::FinishTable("gameserver");
13081315
}
13091316

0 commit comments

Comments
 (0)