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

Get cmd line #310

Merged
merged 5 commits into from May 3, 2020
Merged

Conversation

scalar438
Copy link
Contributor

This is new window command-line getting approach, same as ProcessHacker uses. The approach doesn't require PROCESS_VM_READ access right and works with 32 and 64 bit processes. But unfortunately, it doesn't work in windows 8 and older.

src/sysinfo.rs Outdated Show resolved Hide resolved
res
fn get_cmd_line(handle: HANDLE) -> Vec<String> {
if *WINDOWS_8_1_OR_NEWER
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very weird formatting. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but on this project cargo fmt doesn't work on my computer <_<

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dark magic. :D

@GuillaumeGomez
Copy link
Owner

Can you also provide a benchmark difference between before and after too please?

Otherwise, apart from the lazy_static dependency, seems all good. Thanks a lot for this fix!

@GuillaumeGomez
Copy link
Owner

You forgot to add a condition on lazy_static btw (but please use once_cell anyway).

@GuillaumeGomez
Copy link
Owner

Just the benchmark comparison remaining now and I think we're good to go.

@scalar438
Copy link
Contributor Author

Benchmark results. Before:

test bench_new                     ... bench:   5,806,055 ns/iter (+/- 650,897)
test bench_new_all                 ... bench:  56,814,290 ns/iter (+/- 39,485,834)
test bench_refresh_all             ... bench:   1,545,395 ns/iter (+/- 263,896)
test bench_refresh_components      ... bench:           1 ns/iter (+/- 0)
test bench_refresh_components_list ... bench:   8,277,480 ns/iter (+/- 1,021,416)
test bench_refresh_cpu             ... bench:      21,858 ns/iter (+/- 61,313)
test bench_refresh_disk            ... bench:      10,617 ns/iter (+/- 1,047)
test bench_refresh_disks           ... bench:      10,448 ns/iter (+/- 1,602)
test bench_refresh_disks_list      ... bench:     124,665 ns/iter (+/- 19,034)
test bench_refresh_memory          ... bench:         445 ns/iter (+/- 19)
test bench_refresh_networks        ... bench:      29,175 ns/iter (+/- 1,411)
test bench_refresh_networks_list   ... bench:     124,964 ns/iter (+/- 9,613)
test bench_refresh_process         ... bench:       1,111 ns/iter (+/- 45)
test bench_refresh_processes       ... bench:   1,307,337 ns/iter (+/- 299,907)
test bench_refresh_system          ... bench:      24,576 ns/iter (+/- 80,671)
test bench_refresh_users_list      ... bench:   2,320,985 ns/iter (+/- 306,613)

After:

test bench_new                     ... bench:   5,969,410 ns/iter (+/- 909,018)
test bench_new_all                 ... bench:  76,279,820 ns/iter (+/- 11,253,482)
test bench_refresh_all             ... bench:   1,521,222 ns/iter (+/- 88,023)
test bench_refresh_components      ... bench:           1 ns/iter (+/- 0)
test bench_refresh_components_list ... bench:   7,865,910 ns/iter (+/- 552,797)
test bench_refresh_cpu             ... bench:      17,647 ns/iter (+/- 3,687)
test bench_refresh_disk            ... bench:       9,574 ns/iter (+/- 559)
test bench_refresh_disks           ... bench:       9,619 ns/iter (+/- 346)
test bench_refresh_disks_list      ... bench:     125,337 ns/iter (+/- 29,460)
test bench_refresh_memory          ... bench:         442 ns/iter (+/- 17)
test bench_refresh_networks        ... bench:      28,891 ns/iter (+/- 1,242)
test bench_refresh_networks_list   ... bench:     124,316 ns/iter (+/- 4,281)
test bench_refresh_process         ... bench:       1,050 ns/iter (+/- 82)
test bench_refresh_processes       ... bench:   1,270,540 ns/iter (+/- 75,859)
test bench_refresh_system          ... bench:      19,133 ns/iter (+/- 3,116)
test bench_refresh_users_list      ... bench:   2,264,655 ns/iter (+/- 113,038)

@GuillaumeGomez
Copy link
Owner

So not much changes. This is pretty good news.

@GuillaumeGomez
Copy link
Owner

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 441e876 into GuillaumeGomez:master May 3, 2020
@scalar438 scalar438 deleted the get_cmd_line branch May 3, 2020 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants