Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: fix not updating sysinfo processes correctly #1541

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#1487](https://github.com/ClementTsang/bottom/pull/1487): Add option to move the AVG CPU bar to another row in basic mode.

### Bug Fixes

- [#1541](https://github.com/ClementTsang/bottom/pull/1541): Fix some process details not updating for macOS and Windows.

## [0.10.1] - 2024-08-01

### Bug Fixes
Expand Down
14 changes: 12 additions & 2 deletions src/data_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pub struct SysinfoSource {
impl Default for SysinfoSource {
fn default() -> Self {
use sysinfo::*;

Self {
system: System::new_with_specifics(RefreshKind::new()),
network: Networks::new(),
Expand Down Expand Up @@ -173,6 +174,10 @@ pub struct DataCollector {

impl DataCollector {
pub fn new(filters: DataFilters) -> Self {
// Initialize it to the past to force it to load on initialization.
let now = Instant::now();
let last_collection_time = now.checked_sub(Duration::from_secs(600)).unwrap_or(now);

DataCollector {
data: Data::default(),
sys: SysinfoSource::default(),
Expand All @@ -185,7 +190,7 @@ impl DataCollector {
temperature_type: TemperatureType::Celsius,
use_current_cpu_total: false,
unnormalized_cpu: false,
last_collection_time: Instant::now() - Duration::from_secs(600), /* Initialize it to the past to force it to load on initialization. */
last_collection_time,
total_rx: 0,
total_tx: 0,
show_average_cpu: false,
Expand Down Expand Up @@ -284,7 +289,12 @@ impl DataCollector {
#[cfg(not(target_os = "linux"))]
{
if self.widgets_to_harvest.use_proc {
self.sys.system.refresh_processes();
self.sys.system.refresh_processes_specifics(
sysinfo::ProcessRefreshKind::everything()
.without_environ()
.without_cwd()
.without_root(),
);

// For Windows, sysinfo also handles the users list.
#[cfg(target_os = "windows")]
Expand Down
Loading