D20786: ProcessList: add support for cgroups
This revision was automatically updated to reflect the committed changes. Closed by commit R106:11af9d11a457: ProcessList: add support for cgroups (authored by topimiettinen). REPOSITORY R106 KSysguard CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20786?vs=57093&id=58244 REVISION DETAIL https://phabricator.kde.org/D20786 AFFECTED FILES ksysguardd/Linux/ProcessList.c To: topimiettinen, #plasma, hein, davidedmundson Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen updated this revision to Diff 57093. topimiettinen added a comment. avoid memory allocations and reuse existing validation function REPOSITORY R106 KSysguard CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20786?vs=57091&id=57093 BRANCH processlist-add-cgroup REVISION DETAIL https://phabricator.kde.org/D20786 AFFECTED FILES ksysguardd/Linux/ProcessList.c To: topimiettinen, #plasma, hein Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen added inline comments. INLINE COMMENTS > anthonyfieroni wrote in ProcessList.c:420-421 > I made mistake i mean `i--` we start from last. I also added a check for i not being negative. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D20786 To: topimiettinen, #plasma, hein Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen updated this revision to Diff 57091. topimiettinen added a comment. more trimming logic fixes REPOSITORY R106 KSysguard CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20786?vs=57088&id=57091 BRANCH processlist-add-cgroup REVISION DETAIL https://phabricator.kde.org/D20786 AFFECTED FILES ksysguardd/Linux/ProcessList.c To: topimiettinen, #plasma, hein Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
anthonyfieroni added inline comments. INLINE COMMENTS > anthonyfieroni wrote in ProcessList.c:420-421 > for (int i = strlen(buf) - 1; buf[i] == '\n'; i++) > buf[i] = '\0'; I made mistake i mean `i--` we start from last. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D20786 To: topimiettinen, #plasma, hein Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen updated this revision to Diff 57088. topimiettinen added a comment. improve trimming, thanks to @anthonyfieroni REPOSITORY R106 KSysguard CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20786?vs=57086&id=57088 BRANCH processlist-add-cgroup REVISION DETAIL https://phabricator.kde.org/D20786 AFFECTED FILES ksysguardd/Linux/ProcessList.c To: topimiettinen, #plasma, hein Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen updated this revision to Diff 57086. topimiettinen added a comment. free strdup'ed string REPOSITORY R106 KSysguard CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20786?vs=57070&id=57086 BRANCH processlist-add-cgroup REVISION DETAIL https://phabricator.kde.org/D20786 AFFECTED FILES ksysguardd/Linux/ProcessList.c To: topimiettinen, #plasma, hein Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
anthonyfieroni added inline comments. INLINE COMMENTS > ProcessList.c:420-421 > +if ( buf[0] == '0' && buf[1] == ':' && buf[2] == ':' ) { > + while (buf[strlen(buf) - 1] == '\n') > +buf[strlen(buf) - 1] = '\0'; /* trim trailing newlines */ > + ps->cGroup = strdup( &buf[3] ); for (int i = strlen(buf) - 1; buf[i] == '\n'; i++) buf[i] = '\0'; > ProcessList.c:422 > +buf[strlen(buf) - 1] = '\0'; /* trim trailing newlines */ > + ps->cGroup = strdup( &buf[3] ); > +} strdup allocates memory i don't see where you free it. REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D20786 To: topimiettinen, #plasma, hein Cc: anthonyfieroni, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen updated this revision to Diff 57070. topimiettinen added a comment. trim trailing newlines REPOSITORY R106 KSysguard CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20786?vs=56890&id=57070 BRANCH processlist-add-cgroup REVISION DETAIL https://phabricator.kde.org/D20786 AFFECTED FILES ksysguardd/Linux/ProcessList.c To: topimiettinen, #plasma, hein Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen added a comment. Sample output: ksysguardd> ps? NamePID PPIDUID GID Status User Time System Time NiceVmSize VmRss VmURss Login TracerPID TTY Command IO Priority Class IO Priority NNP CGroup s d d d d S d d d D D D s d s s d d d s ksysguardd> ps init1 -1 0 0 sleeping127 308 0 172216 12060 3176root-1 /sbin/init 0 0 0 /init.scope systemd-udevd 476 1 0 0 sleeping15 18 0 22900 56161520root-1 /lib/systemd/systemd-udevd 0 0 1 /system.slice/systemd-udevd.service kwin_x11958 950 10001000sleeping13918 19025 0 2638008 75776 15984 topi-1 /usr/bin/kwin_x11 -session 10cd6f6f7200014837769930009690022_1544638428_145716 0 0 0 /user.slice/user-1000.slice/session-1.scope REPOSITORY R106 KSysguard REVISION DETAIL https://phabricator.kde.org/D20786 To: topimiettinen Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20786: ProcessList: add support for cgroups
topimiettinen created this revision. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. topimiettinen requested review of this revision. REVISION SUMMARY Signed-off-by: Topi Miettinen REPOSITORY R106 KSysguard BRANCH processlist-add-cgroup REVISION DETAIL https://phabricator.kde.org/D20786 AFFECTED FILES ksysguardd/Linux/ProcessList.c To: topimiettinen Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart