feat: span tracing!!!

This commit is contained in:
Nova
2023-01-14 22:32:41 -05:00
parent 1a5edee751
commit 73f3d99877
15 changed files with 160 additions and 100 deletions

View File

@@ -10,6 +10,7 @@ use serde::Deserialize;
use stardust_xr::schemas::flex::deserialize;
use std::{path::PathBuf, sync::Arc};
use stereokit::{lifecycle::StereoKitDraw, render::StereoKitRender, texture::Texture};
use tracing::instrument;
pub fn create_interface(client: &Arc<Client>) {
let node = Node::create(client, "", "drawable", false);
@@ -20,6 +21,7 @@ pub fn create_interface(client: &Arc<Client>) {
node.add_to_scenegraph();
}
#[instrument(level = "debug", skip(sk))]
pub fn draw(sk: &StereoKitDraw) {
lines::draw_all(sk);
model::draw_all(sk);

View File

@@ -6,6 +6,7 @@ use crate::{
use glam::{vec3, Mat4};
use std::sync::Arc;
use stereokit::input::StereoKitInput;
use tracing::instrument;
lazy_static::lazy_static! {
static ref HMD: Arc<Node> = create();
@@ -18,6 +19,7 @@ fn create() -> Arc<Node> {
node
}
#[instrument(level = "debug", name = "Update HMD Pose", skip(sk))]
pub fn frame(sk: &impl StereoKitInput) {
let spatial = HMD.spatial.get().unwrap();
let hmd_pose = sk.input_head();

View File

@@ -11,9 +11,9 @@ use super::{
spatial::{find_spatial_parent, parse_transform, Spatial},
Node,
};
use crate::core::client::Client;
use crate::core::eventloop::FRAME;
use crate::core::registry::Registry;
use crate::core::{client::Client, task};
use color_eyre::eyre::{ensure, Result};
use glam::Mat4;
use nanoid::nanoid;
@@ -192,25 +192,23 @@ impl InputHandler {
let handler = Arc::downgrade(&distance_link.handler);
if let Ok(data) = node.execute_remote_method("input", data) {
let _ = tokio::task::Builder::new()
.name("input capture")
.spawn(async move {
if let Ok(data) = data.await {
if frame == FRAME.load(Ordering::Relaxed) {
let capture = flexbuffers::Reader::get_root(data.as_slice())
.and_then(|data| data.get_bool())
.unwrap_or(false);
let _ = task::new(|| "input capture", async move {
if let Ok(data) = data.await {
if frame == FRAME.load(Ordering::Relaxed) {
let capture = flexbuffers::Reader::get_root(data.as_slice())
.and_then(|data| data.get_bool())
.unwrap_or(false);
if capture {
if let Some(method) = method.upgrade() {
if let Some(handler) = handler.upgrade() {
method.captures.add_raw(&handler);
}
if capture {
if let Some(method) = method.upgrade() {
if let Some(handler) = handler.upgrade() {
method.captures.add_raw(&handler);
}
}
}
}
});
}
});
}
}
}
@@ -249,6 +247,7 @@ pub fn create_input_handler_flex(
InputHandler::add_to(&node, &field)?;
Ok(())
}
#[tracing::instrument(level = "debug")]
pub fn process_input() {
// Iterate over all valid input methods
for method in INPUT_METHOD_REGISTRY

View File

@@ -5,6 +5,7 @@ use crate::core::registry::Registry;
use color_eyre::eyre::Result;
use glam::Mat4;
use stardust_xr::schemas::flex::{deserialize, serialize};
use tracing::instrument;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
@@ -48,6 +49,7 @@ impl Root {
Ok(())
}
#[instrument(level = "debug")]
pub fn logic_step(delta: f64) {
if let Ok(data) = serialize((delta, 0.0)) {
for root in ROOT_REGISTRY.get_valid_contents() {