mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
track state tick in a historgram too
This commit is contained in:
parent
79cc3af058
commit
88b191dbbb
@ -704,14 +704,11 @@ impl Server {
|
||||
.set((before_persistence_updates - before_entity_cleanup).as_nanos() as i64);
|
||||
tt.with_label_values(&["persistence_updates"])
|
||||
.set((end_of_server_tick - before_persistence_updates).as_nanos() as i64);
|
||||
}
|
||||
|
||||
#[cfg(feature = "tracy")]
|
||||
{
|
||||
use common_base::tracy_client::{create_plot, Plot};
|
||||
let entity_count = self.state.ecs().entities().join().count();
|
||||
static ENTITY_COUNT: Plot = create_plot!("entity count");
|
||||
ENTITY_COUNT.point(entity_count as f64);
|
||||
tick_metrics.tick_time_hist.observe(
|
||||
end_of_server_tick
|
||||
.duration_since(before_state_tick)
|
||||
.as_secs_f64(),
|
||||
);
|
||||
}
|
||||
|
||||
// 9) Finish the tick, pass control back to the frontend.
|
||||
|
@ -1,6 +1,6 @@
|
||||
use prometheus::{
|
||||
Gauge, GaugeVec, HistogramOpts, HistogramVec, IntCounter, IntCounterVec, IntGauge, IntGaugeVec,
|
||||
Opts, Registry,
|
||||
Gauge, GaugeVec, Histogram, HistogramOpts, HistogramVec, IntCounter, IntCounterVec, IntGauge,
|
||||
IntGaugeVec, Opts, Registry,
|
||||
};
|
||||
use std::{
|
||||
convert::TryInto,
|
||||
@ -48,6 +48,7 @@ pub struct TickMetrics {
|
||||
pub chunk_groups_count: IntGauge,
|
||||
pub entity_count: IntGauge,
|
||||
pub tick_time: IntGaugeVec,
|
||||
pub tick_time_hist: Histogram,
|
||||
pub build_info: IntGauge,
|
||||
pub start_time: IntGauge,
|
||||
pub time_of_day: Gauge,
|
||||
@ -262,6 +263,28 @@ impl TickMetrics {
|
||||
Opts::new("tick_time", "time in ns required for a tick of the server"),
|
||||
&["period"],
|
||||
)?;
|
||||
// 33.33ms is the ideal tick time. So we have hight detail around it.
|
||||
// 300/700 are to detect high I/O blocks
|
||||
let bucket = vec![
|
||||
Duration::from_millis(8).as_secs_f64(),
|
||||
Duration::from_millis(16).as_secs_f64(),
|
||||
Duration::from_millis(24).as_secs_f64(),
|
||||
Duration::from_millis(30).as_secs_f64(),
|
||||
Duration::from_millis(33).as_secs_f64(),
|
||||
Duration::from_millis(37).as_secs_f64(),
|
||||
Duration::from_millis(45).as_secs_f64(),
|
||||
Duration::from_millis(60).as_secs_f64(),
|
||||
Duration::from_millis(100).as_secs_f64(),
|
||||
Duration::from_millis(300).as_secs_f64(),
|
||||
Duration::from_millis(700).as_secs_f64(),
|
||||
];
|
||||
let tick_time_hist = Histogram::with_opts(
|
||||
HistogramOpts::new(
|
||||
"tick_time_hist",
|
||||
"shows the detailed time in ns spend for the whole tick as histogram",
|
||||
)
|
||||
.buckets(bucket),
|
||||
)?;
|
||||
|
||||
let since_the_epoch = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
@ -277,6 +300,7 @@ impl TickMetrics {
|
||||
registry.register(Box::new(time_of_day.clone()))?;
|
||||
registry.register(Box::new(light_count.clone()))?;
|
||||
registry.register(Box::new(tick_time.clone()))?;
|
||||
registry.register(Box::new(tick_time_hist.clone()))?;
|
||||
|
||||
Ok(Self {
|
||||
chonks_count,
|
||||
@ -284,6 +308,7 @@ impl TickMetrics {
|
||||
chunk_groups_count,
|
||||
entity_count,
|
||||
tick_time,
|
||||
tick_time_hist,
|
||||
build_info,
|
||||
start_time,
|
||||
time_of_day,
|
||||
|
@ -102,6 +102,12 @@ impl<'a> System<'a> for Sys {
|
||||
if let Some(entities) = entities {
|
||||
let entity_count = entities.join().count();
|
||||
export_tick.entity_count.set(entity_count as i64);
|
||||
#[cfg(feature = "tracy")]
|
||||
{
|
||||
use common_base::tracy_client::{create_plot, Plot};
|
||||
static ENTITY_COUNT: Plot = create_plot!("entity count");
|
||||
ENTITY_COUNT.point(entity_count as f64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user