/* Check Memory Copyright (C) 2019 AleaJactaEst This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "check_memory.h" #include "core/os/os.h" #include "modules/debug/debug.h" #ifdef DEBUG_ENABLED uint64_t memstaticold = 0; uint64_t memdynamicold = 0; uint64_t mempeakold = 0; void show_memory_usage() { uint64_t memstatic = OS::get_singleton()->get_static_memory_usage(); uint64_t memdynamic = OS::get_singleton()->get_dynamic_memory_usage(); uint64_t mempeak = OS::get_singleton()->get_static_memory_peak_usage(); DBG_PRINT("Usage Memory - Current [Static:" + itos(memstatic) + ", Dynamic:" + itos(memdynamic) + ", Peak:" + itos(mempeak) + "] Delta [Static:" + itos(memstatic - memstaticold) + ", Dynamic:" + itos(memdynamic - memdynamicold) + ", Peak:" + itos(mempeak - mempeakold) + "]"); memstaticold = memstatic; memdynamicold = memdynamic; mempeakold = mempeak; } #endif