This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new ee6fb8709b Update sysinfo requirement from 0.30.12 to 0.31.2 (#6182)
ee6fb8709b is described below

commit ee6fb8709b6af4d25e7defdf2cc0e4622ccb6147
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
AuthorDate: Fri Aug 2 17:07:12 2024 +0100

    Update sysinfo requirement from 0.30.12 to 0.31.2 (#6182)
    
    * Update sysinfo requirement from 0.30.12 to 0.31.2
    
    Updates the requirements on 
[sysinfo](https://github.com/GuillaumeGomez/sysinfo) to permit the latest 
version.
    - 
[Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md)
    - 
[Commits](https://github.com/GuillaumeGomez/sysinfo/compare/v0.30.13...v0.31.2)
    
    ---
    updated-dependencies:
    - dependency-name: sysinfo
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    * Update example for new sysinfo API
    
    ---------
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] 
<49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Andrew Lamb <[email protected]>
---
 parquet/Cargo.toml                |  2 +-
 parquet/examples/write_parquet.rs | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/parquet/Cargo.toml b/parquet/Cargo.toml
index 7391d09646..f959827599 100644
--- a/parquet/Cargo.toml
+++ b/parquet/Cargo.toml
@@ -67,7 +67,7 @@ hashbrown = { version = "0.14", default-features = false }
 twox-hash = { version = "1.6", default-features = false }
 paste = { version = "1.0" }
 half = { version = "2.1", default-features = false, features = ["num-traits"] }
-sysinfo = { version = "0.30.12", optional = true, default-features = false }
+sysinfo = { version = "0.31.2", optional = true, default-features = false, 
features = ["system"] }
 
 [dev-dependencies]
 base64 = { version = "0.22", default-features = false, features = ["std"] }
diff --git a/parquet/examples/write_parquet.rs 
b/parquet/examples/write_parquet.rs
index d2ef550df8..9ee88facc9 100644
--- a/parquet/examples/write_parquet.rs
+++ b/parquet/examples/write_parquet.rs
@@ -28,7 +28,7 @@ use parquet::arrow::ArrowWriter as ParquetWriter;
 use parquet::basic::Encoding;
 use parquet::errors::Result;
 use parquet::file::properties::{BloomFilterPosition, WriterProperties};
-use sysinfo::{MemoryRefreshKind, Pid, ProcessRefreshKind, RefreshKind, System};
+use sysinfo::{MemoryRefreshKind, ProcessRefreshKind, ProcessesToUpdate, 
RefreshKind, System};
 
 #[derive(ValueEnum, Clone)]
 enum BloomFilterPositionArg {
@@ -61,8 +61,16 @@ fn now() -> String {
 }
 
 fn mem(system: &mut System) -> String {
-    let pid = Pid::from(std::process::id() as usize);
-    system.refresh_process_specifics(pid, 
ProcessRefreshKind::new().with_memory());
+    let pid = match sysinfo::get_current_pid() {
+        Ok(pid) => pid,
+        Err(e) => return format!("Can't get process PID: {e}"),
+    };
+
+    system.refresh_processes_specifics(
+        ProcessesToUpdate::Some(&[pid]),
+        ProcessRefreshKind::everything(),
+    );
+
     system
         .process(pid)
         .map(|proc| format!("{}MB", proc.memory() / 1_000_000))

Reply via email to