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

Improves verbose mode with more logs #49

Merged
merged 1 commit into from
Apr 28, 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
3 changes: 3 additions & 0 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024 Dotanuki Labs
# SPDX-License-Identifier: MIT

name: "Setup Rust build"
description: "Common steps before running a Rust/Cargo task"

Expand Down
7 changes: 7 additions & 0 deletions src/core/ram/jps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,27 @@ pub fn find_jvm_processes(hsperfdata_locator: fn() -> PathBuf) -> anyhow::Result
.collect::<Vec<_>>();

debug!("");
debug!("Listing launcher packages and PIDs associated with JVM processes:");
debug!("");

processes
.iter()
.for_each(|(pid, launcher)| debug!("Launcher class : {launcher} ({pid})"));

debug!("");

Ok(processes)
}

fn pid_from_jps_file(path_to_file: &Path) -> u32 {
debug!("Evaluating JPS-related files at : {}", path_to_file.to_string_lossy());
let file_path_raw_str = path_to_file.file_name().expect("Not a valid path").to_string_lossy();
file_path_raw_str.parse::<u32>().expect("Cannot parse filename as u32")
}

fn launcher_class_from_monitored_process(path_to_file: &Path) -> String {
debug!("Parsing file : {}", path_to_file.to_string_lossy());

let file_contents_as_bytes = fs::read(path_to_file).expect("Cannot read jps binary file");
let parsing_config = BytesConfig::new(file_contents_as_bytes);
let parsed_binary_info = rust_strings::strings(&parsing_config).expect("Cannot parse jps binary");
Expand Down
1 change: 1 addition & 0 deletions src/core/ram/wiping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::path::PathBuf;
use sysinfo::Pid;

pub fn cleanup_memory(hsperfdata_locator: fn() -> PathBuf, caches: &[MemoryCached]) {
debug!("");
debug!("Cleaning up JVM processes");
debug!("");

Expand Down