Added stats for dropped block loads and meshs

This commit is contained in:
Marc Gilleron 2019-05-12 16:30:45 +01:00
parent 8126d732b6
commit 561f95a506
2 changed files with 13 additions and 0 deletions

View File

@ -397,6 +397,9 @@ void VoxelLodTerrain::_process() {
ProfilingClock profiling_clock;
_stats.dropped_block_loads = 0;
_stats.dropped_block_meshs = 0;
// Here we go...
// Remove blocks falling out of block region extent
@ -560,6 +563,7 @@ void VoxelLodTerrain::_process() {
if (eo.lod >= get_lod_count()) {
// That block was requested at a time where LOD was higher... drop it
++_stats.dropped_block_loads;
continue;
}
@ -568,6 +572,7 @@ void VoxelLodTerrain::_process() {
Set<Vector3i>::Element *E = lod.loading_blocks.find(eo.block_position);
if (E == nullptr) {
// That block was not requested, or is no longer needed. drop it...
++_stats.dropped_block_loads;
continue;
}
@ -576,6 +581,7 @@ void VoxelLodTerrain::_process() {
if (eo.voxels->get_size() != lod.map->get_block_size()) {
// Voxel block size is incorrect, drop it
ERR_PRINT("Block size obtained from provider is different from expected size");
++_stats.dropped_block_loads;
continue;
}
@ -650,6 +656,7 @@ void VoxelLodTerrain::_process() {
if (ob.lod >= get_lod_count()) {
// Sorry, LOD configuration changed, drop that mesh
++_stats.dropped_block_meshs;
continue;
}
@ -672,6 +679,7 @@ void VoxelLodTerrain::_process() {
if (ob.lod >= get_lod_count()) {
// Sorry, LOD configuration changed, drop that mesh
++_stats.dropped_block_meshs;
continue;
}
@ -680,6 +688,7 @@ void VoxelLodTerrain::_process() {
VoxelBlock *block = lod.map->get_block(ob.position);
if (block == NULL) {
// That block is no longer loaded, drop the result
++_stats.dropped_block_meshs;
continue;
}
@ -735,6 +744,8 @@ Dictionary VoxelLodTerrain::get_stats() const {
d["updater"] = VoxelMeshUpdater::to_dictionary(_stats.updater);
d["process"] = process;
d["blocked_lods"] = _stats.blocked_lods;
d["dropped_block_loads"] = _stats.dropped_block_loads;
d["dropped_block_meshs"] = _stats.dropped_block_meshs;
return d;
}

View File

@ -54,6 +54,8 @@ public:
uint64_t time_process_update_responses = 0;
uint64_t time_process_lod = 0;
int blocked_lods = 0;
int dropped_block_loads = 0;
int dropped_block_meshs = 0;
};
Dictionary get_stats() const;