Bug 410945

Summary: KProcessList::processInfo(qint64 pid) iterates through all processes only to filter them
Product: [Frameworks and Libraries] frameworks-kcoreaddons Reporter: David Edmundson <kde>
Component: generalAssignee: David Hallas <david>
Status: RESOLVED FIXED    
Severity: normal CC: david, kdelibs-bugs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description David Edmundson 2019-08-15 15:52:27 UTC
This is unnecessarily slow when we already know which PID we want.
Comment 1 David Edmundson 2019-08-15 15:52:57 UTC
CC'ing original David who wrote it
Comment 2 David Hallas 2019-08-16 16:11:26 UTC
Yeah I see :) I am working on a fix
Comment 3 David Hallas 2019-08-16 16:29:31 UTC
I forget to mention this bugreport in the patch commit message :/

https://phabricator.kde.org/D23205
Comment 4 David Hallas 2019-12-15 06:53:22 UTC
Git commit e16dda4d50bf9e51f1ec1f388f1267bda1c89417 by David Hallas.
Committed on 15/12/2019 at 06:53.
Pushed by hallas into branch 'master'.

[KProcessList] Optimize KProcessList::processInfo

Summary:
Optimize KProcessList::processInfo on unix so that it doesn't iterate over all
processes and then filter the list to the requested process. Instead refactor
the code that fetches process info from a single process and use that function.

Test Plan:
Unit Test

Reviewers: davidedmundson, broulik, mpyne

Reviewed By: mpyne

Subscribers: mpyne, apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23205

M  +0    -15   src/lib/util/kprocesslist.cpp
M  +64   -51   src/lib/util/kprocesslist_unix.cpp
M  +15   -0    src/lib/util/kprocesslist_win.cpp

https://commits.kde.org/kcoreaddons/e16dda4d50bf9e51f1ec1f388f1267bda1c89417