plugin: log dylib load + service init/poll to debug missing singleton registration

This commit is contained in:
Damocles 2026-05-03 17:39:52 +02:00
parent f7c485c881
commit 545812cf75
5 changed files with 43 additions and 1 deletions

View file

@ -77,6 +77,7 @@ impl Default for CpuServiceRust {
impl cxx_qt::Initialize for qobject::CpuService {
fn initialize(mut self: Pin<&mut Self>) {
eprintln!("[nova-plugin] CpuService::initialize");
let max_freqs = read_core_max_freqs();
let types = infer_core_types(&max_freqs);
@ -93,6 +94,7 @@ impl cxx_qt::Initialize for qobject::CpuService {
impl qobject::CpuService {
fn poll(mut self: Pin<&mut Self>) {
eprintln!("[nova-plugin] CpuService::poll");
let curr = cpu::read_stat();
let freqs = cpu::read_core_freqs();
let prev = self.as_ref().rust().prev_stat.clone();

View file

@ -1,3 +1,10 @@
pub mod cpu_service;
pub mod stats;
pub mod system_stats;
// Fires when the .so is dlopen'd. Tells us the plugin file actually loaded,
// independent of whether qml_register_types runs.
#[ctor::ctor(unsafe)]
fn on_dylib_load() {
eprintln!("[nova-plugin] dylib loaded (libNovaStats.so)");
}

View file

@ -116,6 +116,7 @@ impl Default for SystemStatsServiceRust {
impl cxx_qt::Initialize for qobject::SystemStatsService {
fn initialize(mut self: Pin<&mut Self>) {
eprintln!("[nova-plugin] SystemStatsService::initialize");
let backend = gpu::detect_gpu();
let available = !matches!(backend, gpu::GpuBackend::None);
let vendor = match &backend {
@ -132,6 +133,7 @@ impl cxx_qt::Initialize for qobject::SystemStatsService {
impl qobject::SystemStatsService {
fn poll(mut self: Pin<&mut Self>) {
eprintln!("[nova-plugin] SystemStatsService::poll");
self.as_mut().poll_mem();
self.as_mut().poll_temp();
self.as_mut().poll_gpu();
@ -142,8 +144,15 @@ impl qobject::SystemStatsService {
}
fn poll_mem(mut self: Pin<&mut Self>) {
let Some(m) = mem::read_meminfo() else { return };
let Some(m) = mem::read_meminfo() else {
eprintln!("[nova-plugin] poll_mem: read_meminfo returned None");
return;
};
let pct = m.percent as i32;
eprintln!(
"[nova-plugin] poll_mem: pct={pct} used={:.2}gb total={:.2}gb",
m.used_gb, m.total_gb
);
self.as_mut().set_mem_percent(pct);
self.as_mut().set_mem_used_gb(m.used_gb);
self.as_mut().set_mem_total_gb(m.total_gb);