top: implement SUMMARY display#306
Conversation
|
That's great. But can I ask if it can you use text instead of image? That would be more search friendly. |
|
There are no way to measure load average on Windows. We can only get an instantaneous CPU load with this command: The Python wheel I'm not sure what should we do: ignore it, or do what tips: psutil doesn't work well on my computer. it shows |
d535605 to
4a7d223
Compare
|
In fact, the crate we used required us does the same thing: // Must refresh twice.
// https://docs.rs/sysinfo/0.31.2/sysinfo/struct.System.html#method.refresh_cpu_usage
picker::sysinfo().write().unwrap().refresh_all();
sleep(Duration::from_millis(200));
picker::sysinfo().write().unwrap().refresh_all();You can even use a multi-threaded background to refresh this data if |
a7c23e8 to
dbac1d6
Compare
9086112 to
8ec35c2
Compare
8ec35c2 to
1a09cbd
Compare
55eebf7 to
3b8691d
Compare
todo: io wait(only Linux now) cpu load average for Windows cpu load for Macos active user count determine memory unit from `--scale-summary-mem`
3b8691d to
76d5194
Compare
|
i add i check if system is booted by systemd, if so get active user count from it, or from utmp, like what gnu does. so the apt package |
Is there any other way to detect the system is initialized with systemd? (e.g. some features on the |
|
I think using ➜ ~ cat /proc/1/status
Name: systemd
Umask: 0000
State: S (sleeping)
Tgid: 1
Ngid: 0
Pid: 1
PPid: 0
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 256
Groups:
NStgid: 1As you can see the field This method cannot work on other system so you have to use something such as |
|
Yes i used #[cfg]. so as the dependency. if system is booted by systemd, |
|
I would like to mention that platform-specific dependencies do not work with workspace dependencies. Therefore, I specify the version of these dependencies in |
|
The way CPU time is calculated in Windows differs from that in Linux. On Windows, CPU time is divided into the following categories: Should I display them in the following format: Additionally, in the Windows documentation, it mentions reserved fields ( typedef struct
_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
LARGE_INTEGER IdleTime;
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER Reserved1[2];
ULONG Reserved2;
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;I found a possible explanation in psutil. typedef struct {
LARGE_INTEGER IdleTime;
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER DpcTime;
LARGE_INTEGER InterruptTime;
ULONG InterruptCount;
} _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; |
4de224b to
e8d1466
Compare
|
please let me know when I can review it. It doesn't have to be completed to land! |
e8d1466 to
5093892
Compare
|
It seems that the load average on Windows may require opening a new issue. The CPU load for macOS is still to be done. you can begin reviewing the rest of the content. |
07ff31f to
9400acc
Compare
8e0cd3d to
d29e05a
Compare
|
all fixed. |
a22e069 to
db8ecf5
Compare
|
Here's some bug comes from upstream, this pr will be merged after new version of |
|
not severe issue, you can also merge first, and update later. I hope #292 is not waiting for this PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #306 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Resolves #207
Tasks:
--scale-summary-memI add crate
systemstatfor some of the values.