other: more traces to debug, update some deps (#264)

Minor update to update some dependencies and remove some traces.
This commit is contained in:
Clement Tsang 2020-10-02 22:12:07 -04:00 committed by GitHub
parent ba7738e73e
commit 5675d8192c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 17 deletions

View File

@ -42,6 +42,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#261](https://github.com/ClementTsang/bottom/pull/261): Fixed process names occasionally showing up as truncated, due to only using `/proc/<PID>/stat` as our data source.
- [#262](https://github.com/ClementTsang/bottom/pull/262): Fixed missing thread termination steps as well as improper polling causing blocking in input thread.
## [0.4.7] - 2020-08-26
### Bug Fixes

10
Cargo.lock generated
View File

@ -194,13 +194,15 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "chrono"
version = "0.4.15"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
"libc",
"num-integer",
"num-traits",
"time",
"winapi 0.3.9",
]
[[package]]
@ -1276,9 +1278,9 @@ dependencies = [
[[package]]
name = "sysinfo"
version = "0.15.1"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13816d558f404113dfdf855ed982f160cf697b3e573a68b2b798062032182212"
checksum = "67330cbee3b2a819e3365a773f05e884a136603687f812bf24db5b6c3d76b696"
dependencies = [
"cfg-if",
"doc-comment",

View File

@ -27,7 +27,7 @@ codegen-units = 1
anyhow = "1.0.32"
backtrace = "0.3"
battery = "0.7.6"
chrono = "0.4.15"
chrono = "0.4.19"
crossterm = "0.17"
ctrlc = {version = "3.1", features = ["termination"]}
clap = "2.33"
@ -39,7 +39,7 @@ lazy_static = "1.4.0"
libc = "0.2"
regex = "1.3"
serde = {version = "1.0", features = ["derive"] }
sysinfo = "0.15.1"
sysinfo = "0.15.3"
thiserror = "1.0.20"
toml = "0.5.6"
tui = {version = "0.12.0", features = ["crossterm"], default-features = false }

View File

@ -94,6 +94,7 @@ pub struct DataCollector {
impl Default for DataCollector {
fn default() -> Self {
trace!("Creating default data collector...");
DataCollector {
data: Data::default(),
sys: System::new_all(),
@ -114,13 +115,18 @@ impl Default for DataCollector {
battery_manager: None,
battery_list: None,
#[cfg(target_os = "linux")]
page_file_size_kb: unsafe { libc::sysconf(libc::_SC_PAGESIZE) as u64 / 1024 },
page_file_size_kb: unsafe {
let page_file_size_kb = libc::sysconf(libc::_SC_PAGESIZE) as u64 / 1024;
trace!("Page file size in KB: {}", page_file_size_kb);
page_file_size_kb
},
}
}
}
impl DataCollector {
pub fn init(&mut self) {
trace!("Initializing data collector.");
self.mem_total_kb = self.sys.get_total_memory();
trace!("Total memory in KB: {}", self.mem_total_kb);
@ -139,9 +145,10 @@ impl DataCollector {
trace!("Running first run.");
futures::executor::block_on(self.update_data());
trace!("First run done. Sleeping for 250ms...");
std::thread::sleep(std::time::Duration::from_millis(250));
trace!("Running first run cleanup now.");
trace!("First run done. Running first run cleanup now.");
self.data.cleanup();
trace!("Enabled widgets to harvest: {:#?}", self.widgets_to_harvest);

View File

@ -79,10 +79,10 @@ fn main() -> Result<()> {
// Set up input handling
let (sender, receiver) = mpsc::channel();
let input_thread = create_input_thread(sender.clone(), thread_termination_lock.clone());
let _input_thread = create_input_thread(sender.clone(), thread_termination_lock.clone());
// Cleaning loop
let cleaning_thread = {
let _cleaning_thread = {
let lock = thread_termination_lock.clone();
let cvar = thread_termination_cvar.clone();
let cleaning_sender = sender.clone();
@ -114,7 +114,7 @@ fn main() -> Result<()> {
// Event loop
let (collection_thread_ctrl_sender, collection_thread_ctrl_receiver) = mpsc::channel();
let collection_thread = create_collection_thread(
let _collection_thread = create_collection_thread(
sender,
collection_thread_ctrl_receiver,
thread_termination_lock.clone(),
@ -255,13 +255,9 @@ fn main() -> Result<()> {
trace!("Notifying all cvars.");
thread_termination_cvar.notify_all();
trace!("Main/drawing thread is cleaning up.");
cleanup_terminal(&mut terminal, is_debug)?;
trace!("Main/drawing thread is cleaning up.");
cleaning_thread.join().unwrap();
input_thread.join().unwrap();
collection_thread.join().unwrap();
trace!("Fini.");
Ok(())
}

View File

@ -88,6 +88,7 @@ When searching for a process, enables case sensitivity by default.\n\n",
"\
Enables debug logging. The program will print where it logged to after running.",
);
// TODO: [DIAGNOSE] Add a diagnose option to help with debugging.
let disable_click = Arg::with_name("disable_click")
.long("disable_click")
.help("Disables mouse clicks.")

View File

@ -624,11 +624,12 @@ pub fn create_collection_thread(
thread::spawn(move || {
trace!("Spawned collection thread.");
let mut data_state = data_harvester::DataCollector::default();
trace!("Created initial data state.");
trace!("Created default data state.");
data_state.set_collected_data(used_widget_set);
data_state.set_temperature_type(temp_type);
data_state.set_use_current_cpu_total(use_current_cpu_total);
data_state.set_show_average_cpu(show_average_cpu);
trace!("Set default data state settings.");
data_state.init();
trace!("Data state is now fully initialized.");