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

[process][windows] Retrieve process name as basename of executable #1369

Merged
merged 2 commits into from Oct 29, 2022

Conversation

Lomanic
Copy link
Collaborator

@Lomanic Lomanic commented Oct 22, 2022

We align ourself with psutil
https://github.com/giampaolo/psutil/blob/8e4099d9f063ceb4ee3da5845562c5b934f83544/psutil/_pswindows.py#L749-L759

Benchmarks show vast improvements

go test -run=BenchmarkProcessName -bench=BenchmarkProcessName ./process
goos: windows
goarch: amd64
pkg: github.com/shirou/gopsutil/v3/process
cpu: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
BenchmarkProcessName-4               180           6564033 ns/op
BenchmarkProcessNameViaExe-4       22111             51153 ns/op
PASS
ok      github.com/shirou/gopsutil/v3/process   3.914s

Fixes #1368

We align ourself with psutil
https://github.com/giampaolo/psutil/blob/8e4099d9f063ceb4ee3da5845562c5b934f83544/psutil/_pswindows.py#L749-L759

Benchmarks show vast improvements

    go test -run=BenchmarkProcessName -bench=BenchmarkProcessName ./process
    goos: windows
    goarch: amd64
    pkg: github.com/shirou/gopsutil/v3/process
    cpu: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
    BenchmarkProcessName-4               180           6564033 ns/op
    BenchmarkProcessNameViaExe-4       22111             51153 ns/op
    PASS
    ok      github.com/shirou/gopsutil/v3/process   3.914s

Fixes shirou#1368
Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Great PR! Thank you so much!

@shirou shirou merged commit 20b15fb into shirou:master Oct 29, 2022
@Lomanic Lomanic deleted the issue1368 branch October 31, 2022 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows Process.Name() getFromSnapProcess() performance
2 participants