Skip to content

Commit

Permalink
Macos support
Browse files Browse the repository at this point in the history
  • Loading branch information
sauliusgrigaitis committed Dec 25, 2024
1 parent b13ccd1 commit aab7fe0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

Expand Down
6 changes: 3 additions & 3 deletions metrics/src/metric_sys.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
#[cfg(target_os = "linux")]
#[cfg(not(target_os = "windows"))]
use {
anyhow::bail,
psutil::{cpu, process::Process},
Expand All @@ -15,7 +15,7 @@ pub struct ProcessCpuMetric {
pub memory_process_bytes: u64,
}

#[cfg(target_os = "linux")]
#[cfg(not(target_os = "windows"))]
pub fn get_process_cpu_metric() -> Result<ProcessCpuMetric> {
#[expect(unused_assignments)]
let mut cpu_process_seconds_total = 0;
Expand Down Expand Up @@ -78,7 +78,7 @@ pub struct CpuMetric {
}

// TODO maybe work for MacOS or wider Unix?
#[cfg(target_os = "linux")]
#[cfg(not(target_os = "windows"))]
pub fn get_cpu_metric() -> Result<CpuMetric> {
let cpu = cpu::cpu_times()?;
let system_seconds = cpu.total().as_secs();
Expand Down

0 comments on commit aab7fe0

Please sign in to comment.