mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-11-19 02:47:18 +01:00
More stats
This commit is contained in:
parent
9303c652d2
commit
606e131c25
@ -17,6 +17,7 @@ VoxelMap::VoxelMap()
|
||||
}
|
||||
|
||||
VoxelMap::~VoxelMap() {
|
||||
print_line("Destroying VoxelMap");
|
||||
clear();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ VoxelTerrain::VoxelTerrain()
|
||||
}
|
||||
|
||||
VoxelTerrain::~VoxelTerrain() {
|
||||
print_line("Destroying VoxelTerrain");
|
||||
if(_provider_thread) {
|
||||
memdelete(_provider_thread);
|
||||
}
|
||||
@ -232,6 +233,13 @@ Dictionary VoxelTerrain::get_statistics() const {
|
||||
d["provider"] = provider;
|
||||
d["updater"] = updater;
|
||||
|
||||
// Breakdown of time spent in _process
|
||||
d["time_detect_required_blocks"] = _stats.time_detect_required_blocks;
|
||||
d["time_send_load_requests"] = _stats.time_send_load_requests;
|
||||
d["time_process_load_responses"] = _stats.time_process_load_responses;
|
||||
d["time_send_update_requests"] = _stats.time_send_update_requests;
|
||||
d["time_process_update_responses"] = _stats.time_process_update_responses;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
@ -466,6 +474,8 @@ void VoxelTerrain::_process() {
|
||||
|
||||
ERR_FAIL_COND(_map.is_null());
|
||||
|
||||
uint64_t time_before = os.get_ticks_usec();
|
||||
|
||||
// Get viewer location
|
||||
// TODO Transform to local (Spatial Transform)
|
||||
Vector3i viewer_block_pos;
|
||||
@ -519,9 +529,13 @@ void VoxelTerrain::_process() {
|
||||
remove_positions_outside_box(_blocks_pending_update, new_box, _dirty_blocks);
|
||||
}
|
||||
|
||||
_stats.time_detect_required_blocks = os.get_ticks_usec() - time_before;
|
||||
|
||||
_last_view_distance_blocks = _view_distance_blocks;
|
||||
_last_viewer_block_pos = viewer_block_pos;
|
||||
|
||||
time_before = os.get_ticks_usec();
|
||||
|
||||
// Send block loading requests
|
||||
{
|
||||
VoxelProviderThread::InputData input;
|
||||
@ -536,6 +550,9 @@ void VoxelTerrain::_process() {
|
||||
_provider_thread->push(input);
|
||||
}
|
||||
|
||||
_stats.time_send_load_requests = os.get_ticks_usec() - time_before;
|
||||
time_before = os.get_ticks_usec();
|
||||
|
||||
// Get block loading responses
|
||||
{
|
||||
const unsigned int bs = _map->get_block_size();
|
||||
@ -603,6 +620,9 @@ void VoxelTerrain::_process() {
|
||||
}
|
||||
}
|
||||
|
||||
_stats.time_process_load_responses = os.get_ticks_usec() - time_before;
|
||||
time_before = os.get_ticks_usec();
|
||||
|
||||
// Send mesh updates
|
||||
{
|
||||
VoxelMeshUpdater::Input input;
|
||||
@ -641,6 +661,9 @@ void VoxelTerrain::_process() {
|
||||
_blocks_pending_update.clear();
|
||||
}
|
||||
|
||||
_stats.time_send_update_requests = os.get_ticks_usec() - time_before;
|
||||
time_before = os.get_ticks_usec();
|
||||
|
||||
// Get mesh updates
|
||||
{
|
||||
{
|
||||
@ -718,6 +741,8 @@ void VoxelTerrain::_process() {
|
||||
_stats.mesh_alloc_time = time_taken;
|
||||
}
|
||||
|
||||
_stats.time_process_update_responses = os.get_ticks_usec() - time_before;
|
||||
|
||||
//print_line(String("d:") + String::num(_dirty_blocks.size()) + String(", q:") + String::num(_block_update_queue.size()));
|
||||
}
|
||||
|
||||
|
@ -63,13 +63,23 @@ public:
|
||||
int dropped_provider_blocks;
|
||||
int dropped_updater_blocks;
|
||||
int remaining_main_thread_blocks;
|
||||
uint64_t time_detect_required_blocks;
|
||||
uint64_t time_send_load_requests;
|
||||
uint64_t time_process_load_responses;
|
||||
uint64_t time_send_update_requests;
|
||||
uint64_t time_process_update_responses;
|
||||
|
||||
Stats():
|
||||
mesh_alloc_time(0),
|
||||
updated_blocks(0),
|
||||
dropped_provider_blocks(0),
|
||||
dropped_updater_blocks(0),
|
||||
remaining_main_thread_blocks(0)
|
||||
remaining_main_thread_blocks(0),
|
||||
time_detect_required_blocks(0),
|
||||
time_send_load_requests(0),
|
||||
time_process_load_responses(0),
|
||||
time_send_update_requests(0),
|
||||
time_process_update_responses(0)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user