From ba09c942043883a27a61213331d9bcf7fb903634 Mon Sep 17 00:00:00 2001 From: libragliese581 Date: Sat, 28 Dec 2024 20:46:19 +0300 Subject: [PATCH] Added totalRamSize and currentProcessRamUsage --- client/src/bindings/SystemInfo.cpp | 15 +++++++++++++++ shared/deps/cpp-sdk | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/src/bindings/SystemInfo.cpp b/client/src/bindings/SystemInfo.cpp index 24e9a9d1..73869ae0 100644 --- a/client/src/bindings/SystemInfo.cpp +++ b/client/src/bindings/SystemInfo.cpp @@ -24,6 +24,19 @@ static void GetRAMUsage(v8::Local, const v8::PropertyCallbackInfo, const v8::PropertyCallbackInfo& info) +{ + V8_GET_ISOLATE_CONTEXT(); + + V8_RETURN_NUMBER(alt::ICore::Instance().GetTotalRAM()); +} + +static void GetCurrentProcessRamUsage(v8::Local, const v8::PropertyCallbackInfo& info) +{ + V8_GET_ISOLATE_CONTEXT(); + + V8_RETURN_NUMBER(alt::ICore::Instance().GetCurrentProcessRamUsage()); +} extern V8Class v8SystemInfo("SystemInfo", [](v8::Local tpl) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); @@ -31,4 +44,6 @@ extern V8Class v8SystemInfo("SystemInfo", [](v8::Local tpl V8Helpers::SetStaticAccessor(isolate, tpl, "cpuLoad", GetCpuLoad, nullptr); V8Helpers::SetStaticAccessor(isolate, tpl, "videoMemoryUsage", GetVideoMemoryUsage, nullptr); V8Helpers::SetStaticAccessor(isolate, tpl, "ramUsage", GetRAMUsage, nullptr); + V8Helpers::SetStaticAccessor(isolate, tpl, "totalRamSize", GetTotalRAM, nullptr); + V8Helpers::SetStaticAccessor(isolate, tpl, "currentProcessRamUsage", GetCurrentProcessRamUsage, nullptr); }); diff --git a/shared/deps/cpp-sdk b/shared/deps/cpp-sdk index a082f00c..358e45c3 160000 --- a/shared/deps/cpp-sdk +++ b/shared/deps/cpp-sdk @@ -1 +1 @@ -Subproject commit a082f00c7628e0ce6372206975c79ab1572ebc13 +Subproject commit 358e45c31815ea08ac4b61398584eb4d5aae0ae5