mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-01 05:42:44 +01:00
perf(debug): memory of the process and of its parts in the debug panel: resident, peak and private memory, card memory (GL_NVX_gpu_memory_info), the copies kept by the textures, geometry banks, models, scenery shapes and lines, sleepers and sound buffers
This commit is contained in:
@@ -299,6 +299,21 @@ buffer_manager::buffer( audio::buffer_handle const Buffer ) const {
|
||||
}
|
||||
|
||||
// creates AL buffers for files decoded in the background so far, or for all of them if requested
|
||||
// the AL buffers made and the bytes of their sound data, for the debug panel
|
||||
memory_count
|
||||
buffer_manager::memory() const {
|
||||
|
||||
memory_count result;
|
||||
for( auto const &buffer : m_buffers ) {
|
||||
if( buffer.id == null_resource ) { continue; }
|
||||
ALint size { 0 };
|
||||
::alGetBufferi( buffer.id, AL_SIZE, &size );
|
||||
++result.count;
|
||||
result.bytes += static_cast<std::uint64_t>( std::max( size, 0 ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
buffer_manager::update( bool const Wait ) {
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "utilities/memorystats.h"
|
||||
|
||||
#if defined(__APPLE__) && !__has_include(<AL/al.h>)
|
||||
#include <OpenAL/al.h>
|
||||
#include <OpenAL/alc.h>
|
||||
@@ -60,6 +62,9 @@ public:
|
||||
// creates AL buffers for files decoded in the background so far, or for all of them if requested
|
||||
void
|
||||
update( bool const Wait = false );
|
||||
// the AL buffers made and the bytes of their sound data, which the AL keeps in the process, for the debug panel
|
||||
memory_count
|
||||
memory() const;
|
||||
|
||||
private:
|
||||
// types
|
||||
|
||||
@@ -108,6 +108,8 @@ public:
|
||||
audio::openal_buffer const &buffer( audio::buffer_handle const Buffer ) const;
|
||||
// makes buffers of all sound files still decoded in the background (sound.asyncload), waiting for them
|
||||
void complete_buffers();
|
||||
// the sound buffers and the bytes of their data, for the debug panel
|
||||
memory_count buffers_memory() const { return m_buffers.memory(); }
|
||||
|
||||
bool init();
|
||||
|
||||
@@ -164,4 +166,4 @@ private:
|
||||
extern openal_renderer renderer;
|
||||
extern bool event_volume_change;
|
||||
|
||||
} // namespace audio
|
||||
} // namespace audio
|
||||
Reference in New Issue
Block a user