Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

chore: remove the dead code

Louis Beaumont284600c1f6c3
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 10ba0cb33..8c82e2274 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -836,6 +836,7 @@ async fn main() -> anyhow::Result<()> {
"│ frame cache │ {:<34} │",
cli.enable_frame_cache
);
+ println!("│ use all monitors │ {:<34} │", cli.use_all_monitors);
const VALUE_WIDTH: usize = 34;
@@ -1127,6 +1128,8 @@ async fn main() -> anyhow::Result<()> {
let mut shutdown_rx = shutdown_tx.subscribe();
tokio::spawn(async move {
+ // wait 10 seconds
+ tokio::time::sleep(Duration::from_secs(10)).await;
// Start all available monitors immediately
let initial_monitors: HashSet<u32> =
list_monitors().await.into_iter().map(|m| m.id()).collect();
diff --git a/screenpipe-server/src/resource_monitor.rs b/screenpipe-server/src/resource_monitor.rs
index e9672c1a7..0c899e939 100644
--- a/screenpipe-server/src/resource_monitor.rs
+++ b/screenpipe-server/src/resource_monitor.rs
@@ -13,9 +13,6 @@ use std::time::{Duration, Instant};
use sysinfo::{PidExt, ProcessExt, System, SystemExt};
use tracing::{error, info};
-#[cfg(target_os = "macos")]
-use std::process::Command;
-
pub struct ResourceMonitor {
start_time: Instant,
resource_log_file: Option<String>, // analyse output here: https://colab.research.google.com/drive/1zELlGdzGdjChWKikSqZTHekm5XRxY-1r?usp=sharing
@@ -76,28 +73,14 @@ impl ResourceMonitor {
let memory_usage_percent = (total_memory_gb / system_total_memory) * 100.0;
let runtime = self.start_time.elapsed();
- let log_message = if cfg!(target_os = "macos") {
- if let Some(npu_usage) = self.get_npu_usage() {
- format!(
- "Runtime: {}s, Total Memory: {:.0}% ({:.0} GB / {:.0} GB), Total CPU: {:.0}%, NPU: {:.0}%",
- runtime.as_secs(), memory_usage_percent, total_memory_gb, system_total_memory, total_cpu, npu_usage
- )
- } else {
- format!(
- "Runtime: {}s, Total Memory: {:.0}% ({:.0} GB / {:.0} GB), Total CPU: {:.0}%, NPU: N/A",
- runtime.as_secs(), memory_usage_percent, total_memory_gb, system_total_memory, total_cpu
- )
- }
- } else {
- format!(
- "Runtime: {}s, Total Memory: {:.0}% ({:.2} GB / {:.2} GB), Total CPU: {:.0}%",
- runtime.as_secs(),
- memory_usage_percent,
- total_memory_gb,
- system_total_memory,
- total_cpu
- )
- };
+ let log_message = format!(
+ "Runtime: {}s, Total Memory: {:.0}% ({:.2} GB / {:.2} GB), Total CPU: {:.0}%",
+ runtime.as_secs(),
+ memory_usage_percent,
+ total_memory_gb,
+ system_total_memory,
+ total_cpu
+ );
info!("{}", log_message);
@@ -110,7 +93,6 @@ impl ResourceMonitor {
"system_total_memory_gb": system_total_memory,
"memory_usage_percent": memory_usage_percent,
"total_cpu_percent": total_cpu,
- "npu_usage_percent": self.get_npu_usage().unwrap_or(-1.0),
});
if let Ok(mut file) = OpenOptions::new().read(true).write(true).open(filename) {
@@ -157,35 +139,4 @@ impl ResourceMonitor {
}
});
}
-
- #[cfg(target_os = "macos")]
- fn get_npu_usage(&self) -> Option<f32> {
- let output = Command::new("ioreg")
- .args(["-r", "-c", "AppleARMIODevice", "-n", "ane0"])
- .output()
- .ok()?;
-
- let output_str = String::from_utf8_lossy(&output.stdout);
-
- // Parse the output to find the "ane_power" value
- for line in output_str.lines() {
- if line.contains("\"ane_power\"") {
- if let Some(value) = line.split('=').nth(1) {
- if let Ok(power) = value.trim().parse::<f32>() {
- // Assuming max ANE power is 8.0W (adjust if needed)
- let max_ane_power = 8.0;
- let npu_usage_percent = (power / max_ane_power) * 100.0;
- return Some(npu_usage_percent);
- }
- }
- }
- }
-
- None
- }
-
- #[cfg(not(target_os = "macos"))]
- fn get_npu_usage(&self) -> Option<f32> {
- None
- }
}