mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-09 10:45:00 +03:00
Update cpu and memory event code
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
This commit is contained in:
parent
cf5d89d13c
commit
b10255a6dd
@ -90,14 +90,12 @@ pub enum ClickhouseEvent {
|
|||||||
model: &'static str,
|
model: &'static str,
|
||||||
},
|
},
|
||||||
Cpu {
|
Cpu {
|
||||||
usage_as_percent: f32,
|
usage_as_percentage: f32,
|
||||||
core_count: u32,
|
core_count: u32,
|
||||||
},
|
},
|
||||||
Memory {
|
Memory {
|
||||||
memory_in_bytes: u64,
|
memory_in_bytes: u64,
|
||||||
virtual_memory_in_bytes: u64,
|
virtual_memory_in_bytes: u64,
|
||||||
start_time_in_seconds: u64,
|
|
||||||
run_time_in_seconds: u64,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,8 +166,6 @@ impl Telemetry {
|
|||||||
const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(60);
|
const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(60);
|
||||||
smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await;
|
smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await;
|
||||||
|
|
||||||
let telemetry_settings = cx.update(|cx| *settings::get::<TelemetrySettings>(cx));
|
|
||||||
|
|
||||||
system.refresh_memory();
|
system.refresh_memory();
|
||||||
system.refresh_processes();
|
system.refresh_processes();
|
||||||
|
|
||||||
@ -184,15 +180,15 @@ impl Telemetry {
|
|||||||
let memory_event = ClickhouseEvent::Memory {
|
let memory_event = ClickhouseEvent::Memory {
|
||||||
memory_in_bytes: process.memory(),
|
memory_in_bytes: process.memory(),
|
||||||
virtual_memory_in_bytes: process.virtual_memory(),
|
virtual_memory_in_bytes: process.virtual_memory(),
|
||||||
start_time_in_seconds: process.start_time(),
|
|
||||||
run_time_in_seconds: process.run_time(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let cpu_event = ClickhouseEvent::Cpu {
|
let cpu_event = ClickhouseEvent::Cpu {
|
||||||
usage_as_percent: process.cpu_usage(),
|
usage_as_percentage: process.cpu_usage(),
|
||||||
core_count: system.cpus().len() as u32,
|
core_count: system.cpus().len() as u32,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let telemetry_settings = cx.update(|cx| *settings::get::<TelemetrySettings>(cx));
|
||||||
|
|
||||||
this.report_clickhouse_event(memory_event, telemetry_settings);
|
this.report_clickhouse_event(memory_event, telemetry_settings);
|
||||||
this.report_clickhouse_event(cpu_event, telemetry_settings);
|
this.report_clickhouse_event(cpu_event, telemetry_settings);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user