-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
Obtain process info without querying CPU data? #632
Comments
It could be then you wouldn't have the CPU usage for the process. If this what you want, I can put something together. |
That would be fantastic, thanks. Yes, confirmed: for our use case we do not need the CPU usage. (We would use the PID, the timestamp, the owner, and the executable name and command line.) |
Ok, I'll write something up and ask for your opinion on the PR then. |
Great! I'll be happy to take a look (and there might be some other Delta contributors who'll take a look also). |
Sure, since it'll be an API breaking change, the more opinion I have, the better. |
The test program from @ttys3 which Dan linked indeed takes a very long time reading from openat(AT_FDCWD, "/sys/devices/system/cpu/cpu83/cpufreq/scaling_cur_freq", O_RDONLY|O_CLOEXEC) = 3 <0.000033>
statx(3, "", [..]) = 0 <0.000012>
lseek(3, 0, SEEK_CUR) = 0 <0.000006>
read(3, "1592944\n", 4096) = 8 <0.011766> # !!!!!
read(3, "", 4088) = 0 <0.000011> However I did not observe this slowdown when using if true {
let mut f = File::open("/proc/cpuinfo").unwrap();
let mut buf = String::new();
let _ = f.read_to_string(&mut buf);
} This is more a weird kernel issue it seems, so having the option to skip these is definitely a good idea. Another, more deterministic slowdown I observed (compared to Just like |
@th1000s directly read sorry, I did not make it more clear in the demo program. I have made an update to distinguish this condition: https://github.com/ttys3/get-cpu-frequency-slow#important-notice so the when there's no it hit |
* Do not query CPU data when querying process data Fixes #839 Ref GuillaumeGomez/sysinfo#632 * Update branch of sysinfo * Update upstream sysinfo commit Ref GuillaumeGomez/sysinfo#636 * Point sysinfo at an explicit commit rather than a symbolic branch name commit d647acfbf216848a8237e1f9251b2c48860a547f Merge: 989ac6c 67a586c Author: Guillaume Gomez <guillaume1.gomez@gmail.com> Date: 2 hours ago Merge pull request #636 from GuillaumeGomez/update-if-needed Only update processors if needed
@ttys3 sorry, I meant that I do not observe a slowdown when reading The code block I pasted would go directly after |
@GuillaumeGomez thanks very much for this library! We're using it in delta in order to inspect the command line of the calling git process that is supplying our input and it has allowed several new features to be added.
However, we have a question about performance. It looks like, on linux at least, when querying for process info,
sysinfo
always additionally queries for CPU info (even if you limit theRefreshKind
to process):sysinfo/src/linux/system.rs
Lines 296 to 298 in c4e2131
A delta user has put together an investigation showing that the calls to
get_cpu_frequency
in particular can be quite expensive, especially when the system has many logical CPUs: dandavison/delta#839Could it be possible to query the process info alone, without querying for CPU data?
The text was updated successfully, but these errors were encountered: