Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Slow down sampling metric collection rate

Joseph T. Lyons41ff37d56e91
diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs
index a3e7449cf8a..6d70de6138c 100644
--- a/crates/client/src/telemetry.rs
+++ b/crates/client/src/telemetry.rs
@@ -187,10 +187,11 @@ impl Telemetry {
// Avoiding calling `refresh_all()`, just update what we need
system.refresh_specifics(refresh_kind);
+ // Waiting some amount of time before the first query is important to get a reasonable value
+ // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage
+ const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(4 * 60);
+
loop {
- // Waiting some amount of time before the first query is important to get a reasonable value
- // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage
- const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(60);
smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await;
system.refresh_specifics(refresh_kind);
diff --git a/crates/client2/src/telemetry.rs b/crates/client2/src/telemetry.rs
index b303e68183d..71c4c33491e 100644
--- a/crates/client2/src/telemetry.rs
+++ b/crates/client2/src/telemetry.rs
@@ -205,10 +205,11 @@ impl Telemetry {
// Avoiding calling `refresh_all()`, just update what we need
system.refresh_specifics(refresh_kind);
+ // Waiting some amount of time before the first query is important to get a reasonable value
+ // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage
+ const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(4 * 60);
+
loop {
- // Waiting some amount of time before the first query is important to get a reasonable value
- // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage
- const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(60);
smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await;
system.refresh_specifics(refresh_kind);