mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00: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
1 changed files with 4 additions and 8 deletions
|
@ -90,14 +90,12 @@ pub enum ClickhouseEvent {
|
|||
model: &'static str,
|
||||
},
|
||||
Cpu {
|
||||
usage_as_percent: f32,
|
||||
usage_as_percentage: f32,
|
||||
core_count: u32,
|
||||
},
|
||||
Memory {
|
||||
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);
|
||||
smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await;
|
||||
|
||||
let telemetry_settings = cx.update(|cx| *settings::get::<TelemetrySettings>(cx));
|
||||
|
||||
system.refresh_memory();
|
||||
system.refresh_processes();
|
||||
|
||||
|
@ -184,15 +180,15 @@ impl Telemetry {
|
|||
let memory_event = ClickhouseEvent::Memory {
|
||||
memory_in_bytes: process.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 {
|
||||
usage_as_percent: process.cpu_usage(),
|
||||
usage_as_percentage: process.cpu_usage(),
|
||||
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(cpu_event, telemetry_settings);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue