Comments (10)
Oh, interesting. So network just works without any modifications at all?
It's weird that battery doesn't work. Which Linux distro and kernel version are you using?
from systemstat.
Yes, just copy-paste the code for the networks from FreeBSD to Linux and the example show the networks and IP addresses.
For the battery, thought, I get the following:
Battery: error: No such file or directory (os error 2), AC power: true
I use ArchLinux, kernel: 4.10.13.
from systemstat.
What do you have under /sys/class/power_supply
? Can you post the output of the tree
command there?
from systemstat.
Here is the output of /sys/class/power_supply/BAT0
:
.
├── alarm
├── capacity
├── capacity_level
├── cycle_count
├── device -> ../../../PNP0C0A:00
├── energy_full
├── energy_full_design
├── energy_now
├── manufacturer
├── model_name
├── power
│ ├── async
│ ├── autosuspend_delay_ms
│ ├── control
│ ├── runtime_active_kids
│ ├── runtime_active_time
│ ├── runtime_enabled
│ ├── runtime_status
│ ├── runtime_suspended_time
│ └── runtime_usage
├── power_now
├── present
├── serial_number
├── status
├── subsystem -> ../../../../../../../../../class/power_supply
├── technology
├── type
├── uevent
├── voltage_min_design
└── voltage_now
For the battery status, the code for FreeBSD does not work since sysctlnametomib
does not exist on Linux.
from systemstat.
Hmmm, did they change charge_now
to energy_now
(and same with _full
)? What's in these energy
files?
Of course the FreeBSD code does not work. I don't think Linux even has any sysctls for battery status. Linux developers like to invent virtual filesystems for everything :D
from systemstat.
It looks like this is it:
energy_now:
42600000
energy_full:
43200000
After a quick search, I saw that there's upower
that might be worth looking at.
from systemstat.
Sorry for the late response, was busy with stuff. Extracted network into a common unix
module, now works on Linux and OpenBSD. Added the energy_
thing, please test it! (I don't have battery-powered Linux devices right now.)
from systemstat.
I made some fixes in pull request #5.
Also, I noticed the memory used is not reported correctly.
The example show 2 GB used while I have only 775 MB.
from systemstat.
freeram in sysinfo is not what most people would call "free RAM" […] The best option is to use the MemAvailable (as opposed to MemFree) entry in /proc/meminfo instead
I wanted to avoid opening files and parsing strings as much as possible but oh well, Linux.
And MemAvailable
only appeared in 2014. It's not available in old kernels, the Windows Subsystem for Linux, FreeBSD's linprocfs
(I should probably write a patch for that :D), maybe in illumos's Linux compatibility too.
I think PlatformMemory
on Linux should just be a map of all the key-value pairs from /proc/meminfo
, falling back to sysinfo
if there's no /proc/meminfo
… I'll just implement it now
from systemstat.
Actually MemAvailable
"is not suitable to calculate the used memory" hishamhm/htop#96
But anyway /proc/meminfo
is now used, check it out :)
from systemstat.
Related Issues (20)
- Move away from serde-feature-hack
- What is needed to release a new version? HOT 1
- how is systemstat related to the get_sys_info crate? HOT 4
- Support for NetBSD HOT 10
- cpu model
- Fails on i386: error[E0308]: mismatched types HOT 1
- Add cpu_time to the Platform trait
- How build and run info.rs example? HOT 1
- Battery error if a wireless device with battery is attached HOT 1
- wrong number of CPUs from cpu_load() on Linux HOT 4
- Do not use this library if at all possible HOT 1
- CPU load output isn't showing actual load HOT 2
- Crates.io HOT 2
- How to get cpu usage HOT 3
- macOS purgeable space HOT 2
- Support Mac arm64 HOT 3
- Swap support HOT 2
- cpu_temp returns the error message: "Not supported" on Windows 10 HOT 8
- Invoking networks() results in STATUS_ACCESS_VIOLATION HOT 5
- Cross-compil from Linux to Windows failed HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from systemstat.