Added process details in the process list context menu
Needs ReviewPublic

Authored by chrisx on May 11 2018, 2:49 PM.

Details

Summary

The process details dialog displays more information on a process such as number of page faults and context switches. It also makes use of the (seemingly) unused lsofui library to display a list of files opened by the process. Currently it's only implemented for Linux.

Test Plan

Not quite sure how to test this but we can always right click on any process in the process list and choose process details. lsofui does not work for other users' processes.

Diff Detail

Repository
R111 KSysguard Library
Lint
Lint Skipped
Unit
Unit Tests Skipped
chrisx created this revision.May 11 2018, 2:49 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 11 2018, 2:49 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
chrisx requested review of this revision.May 11 2018, 2:49 PM

Relevant screenshot

As for this patch.

I'm not particulalry convinced context switches is a very useful thing, ksysguard isn't catering to be a perf replacement.
But if it's hidden away in a dialog, meh, no real objections.

I don't think we need to have two independent dialogs. The existing "Show detailed memory information" and "Process details". I think they can be merged.

The existing "Show detailed memory information" and "Process details". I think they can be merged.

The show detailed memory information is a QtWebKit-powered "plugin" (I would love to get rid of tbh)

chrisx added a comment.Jun 7 2018, 1:53 PM

The existing "Show detailed memory information" and "Process details". I think they can be merged.

The show detailed memory information is a QtWebKit-powered "plugin" (I would love to get rid of tbh)

Yeah I would personally agree with that. Actually the "Show detailed memory information" dialog crashes ksysguard on my machine immediately (the back trace ends up with libQt5WebKit.so.5). I would try adding memory info to the new dialog and update the diff then.

That crash should be fixed by [1] which I just saw forgot to merge to master

[1] https://cgit.kde.org/breeze.git/commit/?h=Plasma/5.13&id=6d886e9f75d04eb34cd34cac668606d027384f96

chrisx updated this revision to Diff 35891.Jun 9 2018, 3:08 PM

Added detailed memory information to the new process details dialog. Like the original implementation, it displays a message if some of the items are not available.

(Also TIL ksysguard has scripting support... which didn't show up in the handbook whatsoever. It is pretty powerful indeed, but it seems an overkill to implement detailed memory info with scripting.)

Any updates on whether this patch could be merged? It has been a long wait. If there are any improvements I can make to the patch I will be more than happy to put more work into it.

meven added a subscriber: meven.Aug 16 2019, 4:41 PM

I quite like this feature @chrisx
I hope you can still push it forward after all this time.

processui/DetailsDlg.cpp
1 ↗(On Diff #35891)

Personally I would favor a class name with no abbreviation, here DetailsDialog, and here perhaps make it more explicit like ProcessDetailsDialog.

processui/ksysguardprocesslist.cpp
205

Indentation seems off.

1225

if (processes.size() != 1) {

return;

}
You can try to use uncrustify-kf5 to (https://github.com/KDE/kde-dev-scripts/blob/master/uncrustify-kf5) to solve code style and indentation issues.
It works on whole directories only, so you might want to use uncrustify-kf5; git commit --amend --no-edit [files part you are adding/touching] ; git checkout .

I quite like this feature @chrisx
I hope you can still push it forward after all this time.

I'll definitely update the patch if the maintainers show more interest in merging. After all I don't really like the idea of having WebKit (back when the patch was authored) or Chromium in my system monitor in order to view memory details.
... and I have to admit that my code style is a complete mess. I'll fix it in the next patch (if there is one).

chrisx updated this revision to Diff 65628.Sep 8 2019, 2:40 AM
chrisx added a reviewer: mart.

Rebased to master. Removed uses of deprecated class (QRegExp). Tidied the code up a bit.

chrisx added a comment.Sep 8 2019, 2:40 AM

Patch updated. Any suggestions?

meven added a comment.Sep 9 2019, 10:01 PM

Patch updated. Any suggestions?

You have a few code indentation issues, that you can take care of.
https://phabricator.kde.org/D12827#inline-130952

And I think you should rename DetailsDlg to DetailsDialog, we prefer to avoid abbreviations in classes names as a convention.

Also the patch does not apply on master but I guess it depends on D23287 which also needs to be rebased on master...

chrisx updated this revision to Diff 65769.Sep 10 2019, 3:14 PM
chrisx set the repository for this revision to R111 KSysguard Library.

@meven Sorry I've totally forgotten about your suggestions when I was updating the patch...
I have renamed DetailsDlg to ProcessDetailsDialog. But I've got some minor issues with code indentation. I have tried out uncrustify-kf5 (which didn't even work out-of-box. Instead of formatting the files in-place, it produced *.uncrustify files instead. I have uncrustify 0.69, and I worked around the issue by adding --replace to the arguments for uncrystify in uncrustify-kf5). But the script produces way too many changes in some files I changed. One of those files is processes_linux_p.cpp, which uses both spaces and tabs for indentation. So at this moment I've only committed some of the indentation changes.
Any further help with pushing this patch forward would be greatly appreciated.

meven added a comment.Sep 13 2019, 2:08 PM

@meven Sorry I've totally forgotten about your suggestions when I was updating the patch...
I have renamed DetailsDlg to ProcessDetailsDialog. But I've got some minor issues with code indentation. I have tried out uncrustify-kf5 (which didn't even work out-of-box. Instead of formatting the files in-place, it produced *.uncrustify files instead. I have uncrustify 0.69, and I worked around the issue by adding --replace to the arguments for uncrystify in uncrustify-kf5). But the script produces way too many changes in some files I changed. One of those files is processes_linux_p.cpp, which uses both spaces and tabs for indentation. So at this moment I've only committed some of the indentation changes.
Any further help with pushing this patch forward would be greatly appreciated.

Sorry I should have mentioned and better explained.
The uncrustify-kf5 is located kde-dev-scripts and depends on uncrustify.
To use it only for a few files a workaround is to run it git add only the files you mean to commit and then git checkout the files you don't want to chaneg.
If too many lines are concerned better skip this here then.

Please note I am no ksysguard maintainer, and the Ksysguard app is going through a UI renew.