tracing-trace: Spanstats deserializable + public fields

This commit is contained in:
Louis Dureuil 2024-02-01 16:48:08 +01:00
parent 6e772effcb
commit a874dbc841
No known key found for this signature in database

View File

@ -1,7 +1,7 @@
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
use std::time::Duration; use std::time::Duration;
use serde::Serialize; use serde::{Deserialize, Serialize};
use crate::entry::{Entry, NewCallsite, SpanClose, SpanEnter, SpanExit}; use crate::entry::{Entry, NewCallsite, SpanClose, SpanEnter, SpanExit};
use crate::{Error, TraceReader}; use crate::{Error, TraceReader};
@ -12,10 +12,10 @@ enum SpanStatus {
Inside(std::time::Duration), Inside(std::time::Duration),
} }
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
pub struct CallStats { pub struct CallStats {
nb: usize, pub nb: usize,
ns: u64, pub ns: u64,
} }
pub fn to_call_stats<R: std::io::Read>( pub fn to_call_stats<R: std::io::Read>(