Changeset View
Changeset View
Standalone View
Standalone View
processui/ProcessModel.cpp
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Line(s) | 181 | switch(left.column()) { | |||
---|---|---|---|---|---|
257 | case HeadingMemory: { | 257 | case HeadingMemory: { | ||
258 | qlonglong memoryLeft = (processLeft->vmURSS() != -1) ? processLeft->vmURSS() : processLeft->vmRSS(); | 258 | qlonglong memoryLeft = (processLeft->vmURSS() != -1) ? processLeft->vmURSS() : processLeft->vmRSS(); | ||
259 | qlonglong memoryRight = (processRight->vmURSS() != -1) ? processRight->vmURSS() : processRight->vmRSS(); | 259 | qlonglong memoryRight = (processRight->vmURSS() != -1) ? processRight->vmURSS() : processRight->vmRSS(); | ||
260 | return memoryLeft > memoryRight; | 260 | return memoryLeft > memoryRight; | ||
261 | } | 261 | } | ||
262 | case HeadingStartTime: { | 262 | case HeadingStartTime: { | ||
263 | return processLeft->startTime() > processRight->startTime(); | 263 | return processLeft->startTime() > processRight->startTime(); | ||
264 | } | 264 | } | ||
265 | case HeadingNoNewPrivileges: | ||||
266 | return processLeft->noNewPrivileges() > processRight->noNewPrivileges(); | ||||
265 | case HeadingXMemory: | 267 | case HeadingXMemory: | ||
266 | return processLeft->pixmapBytes() > processRight->pixmapBytes(); | 268 | return processLeft->pixmapBytes() > processRight->pixmapBytes(); | ||
267 | case HeadingVmSize: | 269 | case HeadingVmSize: | ||
268 | return processLeft->vmSize() > processRight->vmSize(); | 270 | return processLeft->vmSize() > processRight->vmSize(); | ||
269 | case HeadingSharedMemory: { | 271 | case HeadingSharedMemory: { | ||
270 | qlonglong memoryLeft = (processLeft->vmURSS() != -1) ? processLeft->vmRSS() - processLeft->vmURSS() : 0; | 272 | qlonglong memoryLeft = (processLeft->vmURSS() != -1) ? processLeft->vmRSS() - processLeft->vmURSS() : 0; | ||
271 | qlonglong memoryRight = (processRight->vmURSS() != -1) ? processRight->vmRSS() - processRight->vmURSS() : 0; | 273 | qlonglong memoryRight = (processRight->vmURSS() != -1) ? processRight->vmRSS() - processRight->vmURSS() : 0; | ||
272 | return memoryLeft > memoryRight; | 274 | return memoryLeft > memoryRight; | ||
▲ Show 20 Lines • Show All 478 Lines • ▼ Show 20 Line(s) | 751 | if(process->changes() & (KSysGuard::Process::Usage | KSysGuard::Process::Status) || (process->changes() & KSysGuard::Process::TotalUsage && mShowChildTotals)) { | |||
751 | QModelIndex index = q->createIndex(row, ProcessModel::HeadingCPUUsage, process); | 753 | QModelIndex index = q->createIndex(row, ProcessModel::HeadingCPUUsage, process); | ||
752 | emit q->dataChanged(index, index); | 754 | emit q->dataChanged(index, index); | ||
753 | index = q->createIndex(row, ProcessModel::HeadingCPUTime, process); | 755 | index = q->createIndex(row, ProcessModel::HeadingCPUTime, process); | ||
754 | emit q->dataChanged(index, index); | 756 | emit q->dataChanged(index, index); | ||
755 | //Because of our sorting, changing usage needs to also invalidate the User column | 757 | //Because of our sorting, changing usage needs to also invalidate the User column | ||
756 | index = q->createIndex(row, ProcessModel::HeadingUser, process); | 758 | index = q->createIndex(row, ProcessModel::HeadingUser, process); | ||
757 | emit q->dataChanged(index, index); | 759 | emit q->dataChanged(index, index); | ||
758 | } | 760 | } | ||
761 | if(process->changes() & KSysGuard::Process::Status) { | ||||
762 | totalUpdated++; | ||||
763 | QModelIndex index = q->createIndex(row, ProcessModel::HeadingNoNewPrivileges, process); | ||||
764 | emit q->dataChanged(index, index); | ||||
765 | } | ||||
759 | if(process->changes() & KSysGuard::Process::NiceLevels) { | 766 | if(process->changes() & KSysGuard::Process::NiceLevels) { | ||
760 | totalUpdated++; | 767 | totalUpdated++; | ||
761 | QModelIndex index = q->createIndex(row, ProcessModel::HeadingNiceness, process); | 768 | QModelIndex index = q->createIndex(row, ProcessModel::HeadingNiceness, process); | ||
762 | emit q->dataChanged(index, index); | 769 | emit q->dataChanged(index, index); | ||
763 | } | 770 | } | ||
764 | if(process->changes() & KSysGuard::Process::VmSize) { | 771 | if(process->changes() & KSysGuard::Process::VmSize) { | ||
765 | totalUpdated++; | 772 | totalUpdated++; | ||
766 | QModelIndex index = q->createIndex(row, ProcessModel::HeadingVmSize, process); | 773 | QModelIndex index = q->createIndex(row, ProcessModel::HeadingVmSize, process); | ||
▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Line(s) | 961 | switch( role ) { | |||
956 | { | 963 | { | ||
957 | switch(section) { | 964 | switch(section) { | ||
958 | case HeadingPid: | 965 | case HeadingPid: | ||
959 | case HeadingTty: | 966 | case HeadingTty: | ||
960 | case HeadingMemory: | 967 | case HeadingMemory: | ||
961 | case HeadingXMemory: | 968 | case HeadingXMemory: | ||
962 | case HeadingSharedMemory: | 969 | case HeadingSharedMemory: | ||
963 | case HeadingStartTime: | 970 | case HeadingStartTime: | ||
971 | case HeadingNoNewPrivileges: | ||||
964 | case HeadingIoRead: | 972 | case HeadingIoRead: | ||
965 | case HeadingIoWrite: | 973 | case HeadingIoWrite: | ||
966 | case HeadingVmSize: | 974 | case HeadingVmSize: | ||
967 | case HeadingNiceness: | 975 | case HeadingNiceness: | ||
968 | // return QVariant(Qt::AlignRight); | 976 | // return QVariant(Qt::AlignRight); | ||
969 | case HeadingUser: | 977 | case HeadingUser: | ||
970 | case HeadingCPUUsage: | 978 | case HeadingCPUUsage: | ||
971 | case HeadingCPUTime: | 979 | case HeadingCPUTime: | ||
Show All 30 Lines | 989 | switch(section) { | |||
1002 | case HeadingVmSize: | 1010 | case HeadingVmSize: | ||
1003 | return i18n("<qt>This is the amount of virtual memory space that the process is using, included shared libraries, graphics memory, files on disk, and so on. This number is almost meaningless.</qt>"); | 1011 | return i18n("<qt>This is the amount of virtual memory space that the process is using, included shared libraries, graphics memory, files on disk, and so on. This number is almost meaningless.</qt>"); | ||
1004 | case HeadingMemory: | 1012 | case HeadingMemory: | ||
1005 | return i18n("<qt>This is the amount of real physical memory that this process is using by itself, and approximates the Private memory usage of the process.<br>It does not include any swapped out memory, nor the code size of its shared libraries.<br>This is often the most useful figure to judge the memory use of a program. See What's This for more information.</qt>"); | 1013 | return i18n("<qt>This is the amount of real physical memory that this process is using by itself, and approximates the Private memory usage of the process.<br>It does not include any swapped out memory, nor the code size of its shared libraries.<br>This is often the most useful figure to judge the memory use of a program. See What's This for more information.</qt>"); | ||
1006 | case HeadingSharedMemory: | 1014 | case HeadingSharedMemory: | ||
1007 | return i18n("<qt>This is approximately the amount of real physical memory that this process's shared libraries are using.<br>This memory is shared among all processes that use this library.</qt>"); | 1015 | return i18n("<qt>This is approximately the amount of real physical memory that this process's shared libraries are using.<br>This memory is shared among all processes that use this library.</qt>"); | ||
1008 | case HeadingStartTime: | 1016 | case HeadingStartTime: | ||
1009 | return i18n("<qt>The elapsed time since the process was started.</qt>"); | 1017 | return i18n("<qt>The elapsed time since the process was started.</qt>"); | ||
1018 | case HeadingNoNewPrivileges: | ||||
1019 | return i18n("<qt>Linux flag NoNewPrivileges, if set the process can't gain further privileges via setuid etc.</qt>"); | ||||
1010 | case HeadingCommand: | 1020 | case HeadingCommand: | ||
1011 | return i18n("<qt>The command with which this process was launched.</qt>"); | 1021 | return i18n("<qt>The command with which this process was launched.</qt>"); | ||
1012 | case HeadingXMemory: | 1022 | case HeadingXMemory: | ||
1013 | return i18n("<qt>The amount of pixmap memory that this process is using.</qt>"); | 1023 | return i18n("<qt>The amount of pixmap memory that this process is using.</qt>"); | ||
1014 | case HeadingXTitle: | 1024 | case HeadingXTitle: | ||
1015 | return i18n("<qt>The title of any windows that this process is showing.</qt>"); | 1025 | return i18n("<qt>The title of any windows that this process is showing.</qt>"); | ||
1016 | case HeadingPid: | 1026 | case HeadingPid: | ||
1017 | return i18n("The unique Process ID that identifies this process."); | 1027 | return i18n("The unique Process ID that identifies this process."); | ||
Show All 27 Lines | 1049 | #endif | |||
1045 | case HeadingCPUUsage: | 1055 | case HeadingCPUUsage: | ||
1046 | return i18n("The CPU usage of a process and all of its threads."); | 1056 | return i18n("The CPU usage of a process and all of its threads."); | ||
1047 | case HeadingCPUTime: | 1057 | case HeadingCPUTime: | ||
1048 | return i18n("<qt>The total system and user time that a process and all of its threads have been running on the CPU for. This can be greater than the wall clock time if the process has been across multiple CPU cores."); | 1058 | return i18n("<qt>The total system and user time that a process and all of its threads have been running on the CPU for. This can be greater than the wall clock time if the process has been across multiple CPU cores."); | ||
1049 | case HeadingSharedMemory: | 1059 | case HeadingSharedMemory: | ||
1050 | return i18n("<qt><i>Technical information: </i>This is an approximation of the Shared memory, called SHR in top. It is the number of pages that are backed by a file (see kernel Documentation/filesystems/proc.txt). For an individual process, see \"Detailed Memory Information\" for a more accurate, but slower, calculation of the true Shared memory usage."); | 1060 | return i18n("<qt><i>Technical information: </i>This is an approximation of the Shared memory, called SHR in top. It is the number of pages that are backed by a file (see kernel Documentation/filesystems/proc.txt). For an individual process, see \"Detailed Memory Information\" for a more accurate, but slower, calculation of the true Shared memory usage."); | ||
1051 | case HeadingStartTime: | 1061 | case HeadingStartTime: | ||
1052 | return i18n("<qt><i>Technical information: </i>The underlying value (clock ticks since system boot) is retrieved from /proc/[pid]/stat"); | 1062 | return i18n("<qt><i>Technical information: </i>The underlying value (clock ticks since system boot) is retrieved from /proc/[pid]/stat"); | ||
1063 | case HeadingNoNewPrivileges: | ||||
1064 | return i18n("<qt><i>Technical information: </i>The flag is retrieved from /proc/[pid]/status"); | ||||
1053 | case HeadingCommand: | 1065 | case HeadingCommand: | ||
1054 | return i18n("<qt><i>Technical information: </i>This is from /proc/*/cmdline"); | 1066 | return i18n("<qt><i>Technical information: </i>This is from /proc/*/cmdline"); | ||
1055 | case HeadingXMemory: | 1067 | case HeadingXMemory: | ||
1056 | return i18n("<qt><i>Technical information: </i>This is the amount of memory used by the Xorg process for images for this process. This is memory used in addition to Memory and Shared Memory.<br><i>Technical information: </i>This only counts the pixmap memory, and does not include resource memory used by fonts, cursors, glyphsets etc. See the <code>xrestop</code> program for a more detailed breakdown."); | 1068 | return i18n("<qt><i>Technical information: </i>This is the amount of memory used by the Xorg process for images for this process. This is memory used in addition to Memory and Shared Memory.<br><i>Technical information: </i>This only counts the pixmap memory, and does not include resource memory used by fonts, cursors, glyphsets etc. See the <code>xrestop</code> program for a more detailed breakdown."); | ||
1057 | case HeadingXTitle: | 1069 | case HeadingXTitle: | ||
1058 | return i18n("<qt><i>Technical information: </i>For each X11 window, the X11 property _NET_WM_PID is used to map the window to a PID. If a process' windows are not shown, then that application incorrectly is not setting _NET_WM_PID."); | 1070 | return i18n("<qt><i>Technical information: </i>For each X11 window, the X11 property _NET_WM_PID is used to map the window to a PID. If a process' windows are not shown, then that application incorrectly is not setting _NET_WM_PID."); | ||
1059 | case HeadingPid: | 1071 | case HeadingPid: | ||
1060 | return i18n("<qt><i>Technical information: </i>This is the Process ID. A multi-threaded application is treated a single process, with all threads sharing the same PID. The CPU usage etc will be the total, accumulated, CPU usage of all the threads."); | 1072 | return i18n("<qt><i>Technical information: </i>This is the Process ID. A multi-threaded application is treated a single process, with all threads sharing the same PID. The CPU usage etc will be the total, accumulated, CPU usage of all the threads."); | ||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Line(s) | 1321 | case HeadingStartTime: { | |||
1311 | const auto clockTicksSinceSystemBoot = process->startTime(); | 1323 | const auto clockTicksSinceSystemBoot = process->startTime(); | ||
1312 | const auto clockTicksPerSecond = sysconf(_SC_CLK_TCK); // see man proc or http://superuser.com/questions/101183/what-is-a-cpu-tick | 1324 | const auto clockTicksPerSecond = sysconf(_SC_CLK_TCK); // see man proc or http://superuser.com/questions/101183/what-is-a-cpu-tick | ||
1313 | const auto secondsSinceSystemBoot = (double)clockTicksSinceSystemBoot / clockTicksPerSecond; | 1325 | const auto secondsSinceSystemBoot = (double)clockTicksSinceSystemBoot / clockTicksPerSecond; | ||
1314 | const auto systemBootTime = TimeUtil::systemUptimeAbsolute(); | 1326 | const auto systemBootTime = TimeUtil::systemUptimeAbsolute(); | ||
1315 | const auto absoluteStartTime = systemBootTime.addSecs(secondsSinceSystemBoot); | 1327 | const auto absoluteStartTime = systemBootTime.addSecs(secondsSinceSystemBoot); | ||
1316 | const auto relativeStartTime = absoluteStartTime.secsTo(QDateTime::currentDateTime()); | 1328 | const auto relativeStartTime = absoluteStartTime.secsTo(QDateTime::currentDateTime()); | ||
1317 | return TimeUtil::secondsToHumanElapsedString(relativeStartTime); | 1329 | return TimeUtil::secondsToHumanElapsedString(relativeStartTime); | ||
1318 | } | 1330 | } | ||
1331 | case HeadingNoNewPrivileges: | ||||
1332 | return QString::number(process->noNewPrivileges()); | ||||
1319 | case HeadingCommand: | 1333 | case HeadingCommand: | ||
1320 | { | 1334 | { | ||
1321 | return process->command().replace(QLatin1Char('\n'),QLatin1Char(' ')); | 1335 | return process->command().replace(QLatin1Char('\n'),QLatin1Char(' ')); | ||
1322 | // It would be nice to embolden the process name in command, but this requires that the itemdelegate to support html text | 1336 | // It would be nice to embolden the process name in command, but this requires that the itemdelegate to support html text | ||
1323 | // QString command = process->command; | 1337 | // QString command = process->command; | ||
1324 | // command.replace(process->name, "<b>" + process->name + "</b>"); | 1338 | // command.replace(process->name, "<b>" + process->name + "</b>"); | ||
1325 | // return "<qt>" + command; | 1339 | // return "<qt>" + command; | ||
1326 | } | 1340 | } | ||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Line(s) | 1660 | #endif | |||
1654 | case Qt::TextAlignmentRole: | 1668 | case Qt::TextAlignmentRole: | ||
1655 | switch(index.column() ) { | 1669 | switch(index.column() ) { | ||
1656 | case HeadingUser: | 1670 | case HeadingUser: | ||
1657 | case HeadingCPUUsage: | 1671 | case HeadingCPUUsage: | ||
1658 | return QVariant(Qt::AlignCenter); | 1672 | return QVariant(Qt::AlignCenter); | ||
1659 | case HeadingNiceness: | 1673 | case HeadingNiceness: | ||
1660 | case HeadingCPUTime: | 1674 | case HeadingCPUTime: | ||
1661 | case HeadingStartTime: | 1675 | case HeadingStartTime: | ||
1676 | case HeadingNoNewPrivileges: | ||||
1662 | case HeadingPid: | 1677 | case HeadingPid: | ||
1663 | case HeadingMemory: | 1678 | case HeadingMemory: | ||
1664 | case HeadingXMemory: | 1679 | case HeadingXMemory: | ||
1665 | case HeadingSharedMemory: | 1680 | case HeadingSharedMemory: | ||
1666 | case HeadingVmSize: | 1681 | case HeadingVmSize: | ||
1667 | case HeadingIoWrite: | 1682 | case HeadingIoWrite: | ||
1668 | case HeadingIoRead: | 1683 | case HeadingIoRead: | ||
1669 | return QVariant(Qt::AlignRight | Qt::AlignVCenter); | 1684 | return QVariant(Qt::AlignRight | Qt::AlignVCenter); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 1724 | case HeadingMemory: | |||
1715 | } | 1730 | } | ||
1716 | case HeadingVmSize: | 1731 | case HeadingVmSize: | ||
1717 | return (qlonglong)process->vmSize(); | 1732 | return (qlonglong)process->vmSize(); | ||
1718 | case HeadingSharedMemory: | 1733 | case HeadingSharedMemory: | ||
1719 | if(process->vmRSS() - process->vmURSS() < 0 || process->vmURSS() == -1) return QVariant(QVariant::String); | 1734 | if(process->vmRSS() - process->vmURSS() < 0 || process->vmURSS() == -1) return QVariant(QVariant::String); | ||
1720 | return (qlonglong)(process->vmRSS() - process->vmURSS()); | 1735 | return (qlonglong)(process->vmRSS() - process->vmURSS()); | ||
1721 | case HeadingStartTime: | 1736 | case HeadingStartTime: | ||
1722 | return process->startTime(); // 2015-01-03, gregormi: can maybe be replaced with something better later | 1737 | return process->startTime(); // 2015-01-03, gregormi: can maybe be replaced with something better later | ||
1738 | case HeadingNoNewPrivileges: | ||||
1739 | return process->noNewPrivileges(); | ||||
1723 | case HeadingCommand: | 1740 | case HeadingCommand: | ||
1724 | return process->command(); | 1741 | return process->command(); | ||
1725 | case HeadingIoRead: | 1742 | case HeadingIoRead: | ||
1726 | switch(d->mIoInformation) { | 1743 | switch(d->mIoInformation) { | ||
1727 | case ProcessModel::Bytes: | 1744 | case ProcessModel::Bytes: | ||
1728 | return process->ioCharactersRead(); | 1745 | return process->ioCharactersRead(); | ||
1729 | case ProcessModel::Syscalls: | 1746 | case ProcessModel::Syscalls: | ||
1730 | return process->ioReadSyscalls(); | 1747 | return process->ioReadSyscalls(); | ||
▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Line(s) | 1945 | void ProcessModel::setupHeader() { | |||
1937 | headings << i18nc("process heading", "CPU %"); | 1954 | headings << i18nc("process heading", "CPU %"); | ||
1938 | headings << i18nc("process heading", "CPU Time"); | 1955 | headings << i18nc("process heading", "CPU Time"); | ||
1939 | headings << i18nc("process heading", "IO Read"); | 1956 | headings << i18nc("process heading", "IO Read"); | ||
1940 | headings << i18nc("process heading", "IO Write"); | 1957 | headings << i18nc("process heading", "IO Write"); | ||
1941 | headings << i18nc("process heading", "Virtual Size"); | 1958 | headings << i18nc("process heading", "Virtual Size"); | ||
1942 | headings << i18nc("process heading", "Memory"); | 1959 | headings << i18nc("process heading", "Memory"); | ||
1943 | headings << i18nc("process heading", "Shared Mem"); | 1960 | headings << i18nc("process heading", "Shared Mem"); | ||
1944 | headings << i18nc("process heading", "Relative Start Time"); | 1961 | headings << i18nc("process heading", "Relative Start Time"); | ||
1962 | headings << i18nc("process heading", "NNP"); | ||||
1945 | headings << i18nc("process heading", "Command"); | 1963 | headings << i18nc("process heading", "Command"); | ||
1946 | #if HAVE_X11 | 1964 | #if HAVE_X11 | ||
1947 | if (d->mIsX11) { | 1965 | if (d->mIsX11) { | ||
1948 | headings << i18nc("process heading", "X11 Memory"); | 1966 | headings << i18nc("process heading", "X11 Memory"); | ||
1949 | headings << i18nc("process heading", "Window Title"); | 1967 | headings << i18nc("process heading", "Window Title"); | ||
1950 | } | 1968 | } | ||
1951 | #endif | 1969 | #endif | ||
1952 | 1970 | | |||
▲ Show 20 Lines • Show All 275 Lines • Show Last 20 Lines |