D9689: [WIP] Add a per-process CPU usage graph shown in the process list

Kai Uwe Broulik noreply at phabricator.kde.org
Mon Jan 8 09:30:45 UTC 2018


broulik added a comment.


  Screenshot? :)

INLINE COMMENTS

> ProcessModel.cpp:804
> +         * didn't change though. */
> +        if(mMapProcessCPUHistory.contains(process)) {
> +            auto &history = mMapProcessCPUHistory[process];

Use `find()` to avoid double lookup (contains+operator[])

> ProcessModel.cpp:808
> +            // Only add an entry if the latest one is older than MIN_HIST_AGE
> +            if(!history.size() || timestamp - history.constLast().timestamp > MIN_HIST_AGE) {
> +                if(history.size() == MAX_HIST_ENTRIES)

`isEmpty()`

> ProcessModel.cpp:809
> +            if(!history.size() || timestamp - history.constLast().timestamp > MIN_HIST_AGE) {
> +                if(history.size() == MAX_HIST_ENTRIES)
> +                    history.removeFirst();

Braces also for one-line statements

REPOSITORY
  R111 KSysguard Library

REVISION DETAIL
  https://phabricator.kde.org/D9689

To: fvogt, #plasma
Cc: broulik, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180108/51a1127c/attachment-0001.html>


More information about the Plasma-devel mailing list