Add some more traces

This commit is contained in:
Maximilian Ammann 2022-04-02 16:10:11 +02:00
parent 34d7501f64
commit 50ef17fd6a
2 changed files with 24 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use crate::tessellation::{IndexDataType, OverAlignedVertexBuffer};
use crate::io::geometry_index::TileIndex;
use std::collections::HashSet;
use std::fmt;
use std::fmt::{write, Formatter};
use vector_tile::tile::Layer;
mod geometry_index;
@ -25,6 +26,19 @@ pub enum TileFetchResult {
},
}
impl fmt::Debug for TileFetchResult {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"TileFetchResult({})",
match self {
TileFetchResult::Unavailable { coords, .. } => coords,
TileFetchResult::Tile { coords, .. } => coords,
}
)
}
}
pub struct TileIndexResult {
request_id: TileRequestID,
coords: WorldTileCoords,
@ -78,4 +92,10 @@ pub struct TileRequest {
pub layers: HashSet<String>,
}
impl fmt::Debug for TileRequest {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "TileRequest({})", &self.coords)
}
}
pub type TileRequestID = u32;

View File

@ -93,6 +93,7 @@ impl ThreadLocalTessellatorState {
.and_then(|tile_request_state| tile_request_state.get_tile_request(request_id).cloned())
}
#[tracing::instrument(skip(self, data))]
pub fn process_tile(
&self,
request_id: TileRequestID,
@ -126,6 +127,7 @@ impl ThreadLocalTessellatorState {
Ok(())
}
#[tracing::instrument(skip(self))]
fn index_geometry(&self, request_id: TileRequestID, tile_result: &TileFetchResult) {
match tile_result {
TileFetchResult::Tile { data, coords } => {
@ -153,6 +155,7 @@ impl ThreadLocalTessellatorState {
}
}
#[tracing::instrument(skip(self))]
fn tessellate_layers_with_request(
&self,
tile_result: &TileFetchResult,
@ -265,6 +268,7 @@ impl IOScheduler {
}
}
#[tracing::instrument]
pub fn try_populate_cache(&mut self) {
if let Ok(mut tile_request_state) = self.tile_request_state.try_lock() {
if let Ok(result) = self.tessellate_channel.1.try_recv() {