[-]
[+]
|
Changed |
libksysguard.spec
|
|
[-]
[+]
|
Added |
libksysguard-5.3.0.tar.xz/.reviewboardrc
^
|
@@ -0,0 +1,5 @@
+REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
+REPOSITORY = 'git://anongit.kde.org/libksysguard'
+BRANCH = 'master'
+TARGET_GROUPS = 'kde-baseapps'
+# TARGET_PEOPLE = 'johnflux' # the maintainer; commented out because it overwrites hand-selected people when doing an RR update
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/CMakeLists.txt
^
|
@@ -1,5 +1,5 @@
project(libksysguard)
-set(PROJECT_VERSION "5.2.0")
+set(PROJECT_VERSION "5.3.0")
set(PROJECT_VERSION_MAJOR 5)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
@@ -33,9 +33,14 @@
include(ECMInstallIcons)
include(ECMPackageConfigHelpers)
include(CheckIncludeFiles)
+include(ECMSetupVersion)
-write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/KF5SysGuardConfigVersion.cmake VERSION
- "${PROJECT_VERSION}" COMPATIBILITY AnyNewerVersion)
+ecm_setup_version(${PROJECT_VERSION}
+ VARIABLE_PREFIX KSYSGUARD
+ VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ksysguard_version.h"
+ PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5SysGuardConfigVersion.cmake"
+ SOVERSION 7
+)
find_package(X11)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/ksgrd/CMakeLists.txt
^
|
@@ -31,7 +31,7 @@
KF5::ProcessCore
)
-set_target_properties(ksgrd PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} EXPORT_NAME SysGuard)
+set_target_properties(ksgrd PROPERTIES VERSION ${KSYSGUARD_VERSION_STRING} SOVERSION ${KSYSGUARD_SOVERSION} EXPORT_NAME SysGuard)
install(TARGETS ksgrd EXPORT libksysguardLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(FILES SensorAgent.h SensorClient.h SensorManager.h SensorShellAgent.h SensorSocketAgent.h DESTINATION ${INCLUDE_INSTALL_DIR}/ksysguard/ksgrd COMPONENT Devel)
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/lsofui/CMakeLists.txt
^
|
@@ -18,7 +18,7 @@
PRIVATE
KF5::I18n
)
-set_target_properties(lsofui PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} EXPORT_NAME LsofUi)
+set_target_properties(lsofui PROPERTIES VERSION ${KSYSGUARD_VERSION_STRING} SOVERSION ${KSYSGUARD_SOVERSION} EXPORT_NAME LsofUi)
install(TARGETS lsofui EXPORT libksysguardLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files ###############
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/CMakeLists.txt
^
|
@@ -32,7 +32,7 @@
endif()
target_include_directories(processcore PUBLIC "$<BUILD_INTERFACE:${libksysguard_SOURCE_DIR}>" "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/ksysguard>")
-set_target_properties(processcore PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} EXPORT_NAME ProcessCore)
+set_target_properties(processcore PROPERTIES VERSION ${KSYSGUARD_VERSION_STRING} SOVERSION ${KSYSGUARD_SOVERSION} EXPORT_NAME ProcessCore)
install(TARGETS processcore EXPORT libksysguardLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files ###############
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/actions.actions
^
|
@@ -1,7 +1,6 @@
[Domain]
Name=KSysGuard
Name[ar]=حارس نظام كيدي
-Name[ast]=KSysGuard
Name[bg]=Системна защита
Name[br]=KSysGuard
Name[bs]=KSysGuard
@@ -79,7 +78,6 @@
[org.kde.ksysguard.processlisthelper.sendsignal]
Name=Kill or stop etc a process
Name[ar]=اقتل أو أوقف عملية
-Name[ast]=Mata o para un procesu
Name[bg]=Прекратяване на процес
Name[bs]=Ukini, zaustavi, itd. proces
Name[ca]=Mata o atura un procés
@@ -144,7 +142,6 @@
Name[zh_TW]=砍掉或停止行程
Description=Sends a given signal to a given process
Description[ar]=يرسل إشارة معينة إلى عمليّة معينة
-Description[ast]=Manda una señal dada a ciertu procesu
Description[bg]=Изпращане на сигнал до процес
Description[bs]=Šalje dati signal datom procesu
Description[ca]=Envia un senyal determinat a un procés indicat
@@ -212,7 +209,6 @@
[org.kde.ksysguard.processlisthelper.renice]
Name=Change the priority of a process
Name[ar]=غيِّر أولوية عمليّة
-Name[ast]=Camudar la prioridá d'un procesu
Name[bg]=Промяна приоритета на процес
Name[bs]=Promijeni prioritet procesa
Name[ca]=Canvia la prioritat d'un procés
@@ -279,7 +275,6 @@
Name[zh_TW]=變更行程的優先權
Description=Change the niceness of a given process
Description[ar]=غيِّر لطف عمليّة معيّنة
-Description[ast]=Camudar la prioridá d'un determináu procesu
Description[bs]=Mijenja finoću datog procesa
Description[ca]=Canvia la prioritat «niceness» d'un procés indicat
Description[ca@valencia]=Canvia la prioritat «niceness» d'un procés indicat
@@ -345,7 +340,6 @@
[org.kde.ksysguard.processlisthelper.changeioscheduler]
Name=Change IO Scheduler and priority
Name[ar]=غيِّر مجدوِل و أولوية الدخل و الخرج
-Name[ast]=Camudar planificador d'E/S y prioridá
Name[bg]=Промяна на планирането на входно-изходните операции и приоритети
Name[bs]=Promijeni raspoređivač U/I‑ja i prioritet
Name[ca]=Canvia el planificador d'E/S i la prioritat
@@ -408,7 +402,6 @@
Name[zh_TW]=變更 IO 排程器與優先權
Description=Change how the read and writes of a given process are prioritized
Description[ar]=غيِّر كيفية تصنيف عمليات القراءة والكتابة لعمليَّة معيّنة
-Description[ast]=Camudar cómo se prioricen la llectura y escritura d'un procesu dau
Description[bg]=Промяна на приоритета на действията за четене и писане на процес
Description[bs]=Mijenja prioritet čitanja i pisanja za dati proces
Description[ca]=Canvia com es prioritzen les lectures i les escriptures d'un procés indicat
@@ -473,7 +466,6 @@
[org.kde.ksysguard.processlisthelper.changecpuscheduler]
Name=Change CPU Scheduler and priority
Name[ar]=غيِّر مجدول وأولوية وحدة المعالجة المركزية
-Name[ast]=Camudar el planificador de CPU y la prioridá
Name[bs]=Promijeni raspoređivač CPU‑a i prioritet
Name[ca]=Canvia el planificador de la CPU i la prioritat
Name[ca@valencia]=Canvia el planificador de la CPU i la prioritat
@@ -535,7 +527,6 @@
Name[zh_TW]=變更 CPU 排程器與優先權
Description=Change which CPU scheduler is to schedule the running of a given process
Description[ar]=غيِّر مجدول وحدة المعالجة المركزية المستخدم لجدولة تشغيل عمليَّة معيّنة
-Description[ast]=Camudar cómo'l planificador de CPU decidirá la execución d'un procesu dau
Description[bs]=Mijenja raspoređivač CPU‑a kojem se pokorava dati proces
Description[ca]=Canvia el planificador de CPU que planificarà l'execució d'un procés indicat
Description[ca@valencia]=Canvia el planificador de CPU que planificarà l'execució d'un procés indicat
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/process.cpp
^
|
@@ -22,40 +22,110 @@
#include "process.h"
#include <KLocalizedString>
+namespace KSysGuard
+{
-KSysGuard::Process::Process() {
+class ProcessPrivate {
+public:
+ long pid;
+ long parent_pid;
+ Process *parent;
+ QString login;
+ qlonglong uid;
+ qlonglong euid;
+ qlonglong suid;
+ qlonglong fsuid;
+ qlonglong gid;
+ qlonglong egid;
+ qlonglong sgid;
+ qlonglong fsgid;
+ qlonglong tracerpid;
+ QByteArray tty;
+ qlonglong userTime;
+ qlonglong sysTime;
+ qlonglong startTime;
+ int userUsage;
+ int sysUsage;
+ int totalUserUsage;
+ int totalSysUsage;
+ unsigned long numChildren;
+ int niceLevel;
+ Process::Scheduler scheduler;
+ Process::IoPriorityClass ioPriorityClass;
+ int ioniceLevel;
+ qlonglong vmSize;
+ qlonglong vmRSS;
+ qlonglong vmURSS;
+ qlonglong vmSizeChange;
+ qlonglong vmRSSChange;
+ qlonglong vmURSSChange;
+ unsigned long pixmapBytes;
+ bool hasManagedGuiWindow;
+ QString name;
+ QString command;
+ Process::ProcessStatus status;
+ qlonglong ioCharactersRead;
+ qlonglong ioCharactersWritten;
+ qlonglong ioReadSyscalls;
+ qlonglong ioWriteSyscalls;
+ qlonglong ioCharactersActuallyRead;
+ qlonglong ioCharactersActuallyWritten;
+ long ioCharactersReadRate;
+ long ioCharactersWrittenRate;
+ long ioReadSyscallsRate;
+ long ioWriteSyscallsRate;
+ long ioCharactersActuallyReadRate;
+ long ioCharactersActuallyWrittenRate;
+ int numThreads;
+ QList<Process *> children;
+ QTime timeKillWasSent;
+ int index;
+ Process::Changes changes;
+ int elapsedTimeMilliSeconds;
+};
+
+Process::Process()
+ : d(new ProcessPrivate())
+{
clear();
}
-KSysGuard::Process::Process(qlonglong _pid, qlonglong _ppid, Process *_parent) {
+
+Process::Process(qlonglong _pid, qlonglong _ppid, Process *_parent)
+ : d(new ProcessPrivate())
+{
clear();
- pid = _pid;
- parent_pid = _ppid;
- parent = _parent;
+ d->pid = _pid;
+ d->parent_pid = _ppid;
+ d->parent = _parent;
+}
+
+Process::~Process()
+{
+ delete d;
}
-QString KSysGuard::Process::niceLevelAsString() const {
+QString Process::niceLevelAsString() const {
// Just some rough heuristic to map a number to how nice it is
- if( niceLevel == 0) return i18nc("Process Niceness", "Normal");
- if( niceLevel >= 10) return i18nc("Process Niceness", "Very low priority");
- if( niceLevel > 0) return i18nc("Process Niceness", "Low priority");
- if( niceLevel <= -10) return i18nc("Process Niceness", "Very high priority");
- if( niceLevel < 0) return i18nc("Process Niceness", "High priority");
+ if (d->niceLevel == 0) return i18nc("Process Niceness", "Normal");
+ if (d->niceLevel >= 10) return i18nc("Process Niceness", "Very low priority");
+ if (d->niceLevel > 0) return i18nc("Process Niceness", "Low priority");
+ if (d->niceLevel <= -10) return i18nc("Process Niceness", "Very high priority");
+ if (d->niceLevel < 0) return i18nc("Process Niceness", "High priority");
return QString(); //impossible;
}
-QString KSysGuard::Process::ioniceLevelAsString() const {
+QString Process::ioniceLevelAsString() const {
// Just some rough heuristic to map a number to how nice it is
- if( ioniceLevel == 4) return i18nc("Process Niceness", "Normal");
- if( ioniceLevel >= 6) return i18nc("Process Niceness", "Very low priority");
- if( ioniceLevel > 4) return i18nc("Process Niceness", "Low priority");
- if( ioniceLevel <= 2) return i18nc("Process Niceness", "Very high priority");
- if( ioniceLevel < 4) return i18nc("Process Niceness", "High priority");
+ if (d->ioniceLevel == 4) return i18nc("Process Niceness", "Normal");
+ if (d->ioniceLevel >= 6) return i18nc("Process Niceness", "Very low priority");
+ if (d->ioniceLevel > 4) return i18nc("Process Niceness", "Low priority");
+ if (d->ioniceLevel <= 2) return i18nc("Process Niceness", "Very high priority");
+ if (d->ioniceLevel < 4) return i18nc("Process Niceness", "High priority");
return QString(); //impossible;
-
}
-QString KSysGuard::Process::ioPriorityClassAsString() const {
- switch( ioPriorityClass ) {
+QString Process::ioPriorityClassAsString() const {
+ switch (d->ioPriorityClass) {
case None: return i18nc("Priority Class", "None");
case RealTime: return i18nc("Priority Class", "Real Time");
case BestEffort: return i18nc("Priority Class", "Best Effort");
@@ -64,8 +134,8 @@
}
}
-QString KSysGuard::Process::translatedStatus() const {
- switch( status ) {
+QString Process::translatedStatus() const {
+ switch (d->status) {
case Running: return i18nc("process status", "running");
case Sleeping: return i18nc("process status", "sleeping");
case DiskSleep: return i18nc("process status", "disk sleep");
@@ -77,8 +147,8 @@
}
}
-QString KSysGuard::Process::schedulerAsString() const {
- switch( scheduler ) {
+QString Process::schedulerAsString() const {
+ switch (d->scheduler) {
case Fifo: return i18nc("Scheduler", "FIFO");
case RoundRobin: return i18nc("Scheduler", "Round Robin");
case Interactive: return i18nc("Scheduler", "Interactive");
@@ -88,254 +158,611 @@
}
}
-void KSysGuard::Process::clear() {
- pid = -1;
- parent_pid = -1;
- uid = 0;
- gid = -1;
- numThreads = 0;
- suid = euid = fsuid = -1;
- sgid = egid = fsgid = -1;
- tracerpid = -1;
- userTime = 0;
- sysTime = 0;
- elapsedTimeMilliSeconds = 0;
- userUsage=0;
- sysUsage=0;
- totalUserUsage=0;
- totalSysUsage=0;
- numChildren=0;
- niceLevel=0;
- vmSize=0;
- vmRSS = 0;
- vmURSS = 0;
- vmSizeChange = 0;
- vmRSSChange = 0;
- vmURSSChange = 0;
- pixmapBytes = 0;
- hasManagedGuiWindow = false;
- status=OtherStatus;
- parent = NULL;
- ioPriorityClass = None;
- ioniceLevel = -1;
- scheduler = Other;
- ioCharactersRead = 0;
- ioCharactersWritten = 0;
- ioReadSyscalls = 0;
- ioWriteSyscalls = 0;
- ioCharactersActuallyRead = 0;
- ioCharactersActuallyWritten = 0;
- ioCharactersReadRate = 0;
- ioCharactersWrittenRate = 0;
- ioReadSyscallsRate = 0;
- ioWriteSyscallsRate = 0;
- ioCharactersActuallyReadRate = 0;
- ioCharactersActuallyWrittenRate = 0;
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/process.h
^
|
@@ -1,6 +1,7 @@
/* This file is part of the KDE project
Copyright (C) 2007 John Tapsell <tapsell@kde.org>
+ Copyright (C) 2015 Gregor Mi <codestruct@posteo.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -18,8 +19,8 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef PROCESS_H_
-#define PROCESS_H_
+#ifndef PROCESS_H
+#define PROCESS_H
#include <QtCore/QList>
#include <QtCore/QTime>
@@ -27,17 +28,22 @@
namespace KSysGuard
{
+class ProcessPrivate; // forward decl d-ptr
- class Q_DECL_EXPORT Process {
- public:
- enum ProcessStatus { Running, Sleeping, DiskSleep, Zombie, Stopped, Paging, Ended, OtherStatus=99 };
+class Q_DECL_EXPORT Process {
+public:
+ enum ProcessStatus { Running, Sleeping, DiskSleep, Zombie, Stopped, Paging, Ended, OtherStatus = 99 };
enum IoPriorityClass { None, RealTime, BestEffort, Idle };
enum Scheduler { Other = 0, Fifo, RoundRobin, Batch, SchedulerIdle, Interactive }; ///< Interactive is Solaris only
+
Process();
Process(qlonglong _pid, qlonglong _ppid, Process *_parent);
+ virtual ~Process();
+
+ long pid() const; ///< The system's ID for this process. 1 for init. -1 for our virtual 'parent of init' process used just for convenience.
- long pid; ///< The system's ID for this process. 1 for init. -1 for our virtual 'parent of init' process used just for convenience.
- long parent_pid; ///< The system's ID for the parent of this process. Set to -1 if it has no parent (e.g. 'init' on Linux).
+ long parentPid() const; ///< The system's ID for the parent of this process. Set to -1 if it has no parent (e.g. 'init' on Linux).
+ void setParentPid(long parent_pid);
/** A guaranteed NON-NULL pointer for all real processes to the parent process except for the fake process with pid -1.
* The Parent's pid is the same value as the parent_pid. The parent process will be also pointed
@@ -45,116 +51,174 @@
* For process without a parent (such as 'init' on Linux, parent will point to a (fake) process with pid -1 to simplify things.
* For the fake process, this will point to NULL
*/
- Process *parent;
+ Process *parent() const;
+ void setParent(Process *parent);
- void setNumThreads(int number); ///< The number of threads that this process has, including this process.
+ QList<Process *> & children() const; // REF, make non-ref later! ///< A list of all the direct children that the process has. Children of children are not listed here, so note that children_pids <= numChildren
+
+ unsigned long& numChildren() const; // REF, make non-ref later!
+
+ QString login() const;
void setLogin(QString login); ///< The user login name. Only used for processes on remote machines. Otherwise use uid to get the name
+
+ qlonglong uid() const;
void setUid(qlonglong uid); ///< The user id that the process is running as
+
+ qlonglong euid() const;
void setEuid(qlonglong euid); ///< The effective user id that the process is running as
+
+ qlonglong suid() const;
void setSuid(qlonglong suid); ///< The set user id that the process is running as
+
+ qlonglong fsuid() const;
void setFsuid(qlonglong fsuid); ///< The file system user id that the process is running as.
+ qlonglong gid() const;
void setGid(qlonglong gid); ///< The process group id that the process is running as
+
+ qlonglong egid() const;
void setEgid(qlonglong egid); ///< The effective group id that the process is running as
+
+ qlonglong sgid() const;
void setSgid(qlonglong sgid); ///< The set group id that the process is running as
+
+ qlonglong fsgid() const;
void setFsgid(qlonglong fsgid); ///< The file system group id that the process is running as
+ qlonglong tracerpid() const;
void setTracerpid(qlonglong tracerpid); ///< If this is being debugged, this is the process that is debugging it, or 0 otherwise
+
+ QByteArray tty() const;
void setTty(QByteArray tty); ///< The name of the tty the process owns
+
+ qlonglong userTime() const;
void setUserTime(qlonglong userTime); ///< The time, in 100ths of a second, spent in total on user calls. -1 if not known
+
+ qlonglong sysTime() const;
void setSysTime(qlonglong sysTime); ///< The time, in 100ths of a second, spent in total on system calls. -1 if not known
+
+ /**
+ * the value is expressed in clock ticks (since Linux 2.6; we only handle this case) since system boot
+ */
+ qlonglong startTime() const;
+ void setStartTime(qlonglong startTime); /// The time the process started after system boot. Since Linux 2.6, the value is expressed in clock ticks. See man proc.
+
+ int userUsage() const;
void setUserUsage(int userUsage); ///< Percentage (0 to 100). It might be more than 100% on multiple cpu core systems
+
+ int sysUsage() const;
void setSysUsage(int sysUsage); ///< Percentage (0 to 100). It might be more than 100% on multiple cpu core systems
+
+ int& totalUserUsage() const; // REF, make non-ref later!
void setTotalUserUsage(int totalUserUsage); ///< Percentage (0 to 100) from the sum of itself and all its children recursively. If there's no children, it's equal to userUsage. It might be more than 100% on multiple cpu core systems
+
+ int& totalSysUsage() const; // REF, make non-ref later!
void setTotalSysUsage(int totalSysUsage); ///< Percentage (0 to 100) from the sum of itself and all its children recursively. If there's no children, it's equal to sysUsage. It might be more than 100% on multiple cpu core systems
+
+ int niceLevel() const;
void setNiceLevel(int niceLevel); ///< If Scheduler = Other, niceLevel is the niceness (-20 to 20) of this process. A lower number means a higher priority. Otherwise sched priority (1 to 99)
- void setscheduler(Scheduler scheduler); ///< The scheduler this process is running in. See man sched_getscheduler for more info
+
+ Scheduler scheduler() const;
+ void setScheduler(Scheduler scheduler); ///< The scheduler this process is running in. See man sched_getscheduler for more info
+
+ IoPriorityClass ioPriorityClass() const;
void setIoPriorityClass(IoPriorityClass ioPriorityClass); ///< The IO priority class. See man ionice for detailed information.
+
+ int ioniceLevel() const;
void setIoniceLevel(int ioniceLevel); ///< IO Niceness (0 to 7) of this process. A lower number means a higher io priority. -1 if not known or not applicable because ioPriorityClass is Idle or None
+
+ qlonglong vmSize() const;
void setVmSize(qlonglong vmSize); ///< Virtual memory size in KiloBytes, including memory used, mmap'ed files, graphics memory etc,
+
+ qlonglong vmRSS() const;
void setVmRSS(qlonglong vmRSS); ///< Physical memory used by the process and its shared libraries. If the process and libraries are swapped to disk, this could be as low as 0
+
+ qlonglong vmURSS() const;
void setVmURSS(qlonglong vmURSS); ///< Physical memory used only by the process, and not counting the code for shared libraries. Set to -1 if unknown
+
+ QString name() const;
void setName(QString name); ///< The name (e.g. "ksysguard", "konversation", "init")
+
+ QString& command() const; // REF, make non-ref later!
void setCommand(QString command); ///< The command the process was launched with
+
+ ProcessStatus status() const;
void setStatus( ProcessStatus status); ///< Whether the process is running/sleeping/etc
+ qlonglong ioCharactersRead() const;
void setIoCharactersRead(qlonglong number); ///< The number of bytes which this task has caused to be read from storage
+
+ qlonglong ioCharactersWritten() const;
void setIoCharactersWritten(qlonglong number); ///< The number of bytes which this task has caused, or shall cause to be written to disk.
+
+ qlonglong ioReadSyscalls() const;
void setIoReadSyscalls(qlonglong number); ///< Number of read I/O operations, i.e. syscalls like read() and pread().
+
+ qlonglong ioWriteSyscalls() const;
void setIoWriteSyscalls(qlonglong number); ///< Number of write I/O operations, i.e. syscalls like write() and pwrite().
+
+ qlonglong ioCharactersActuallyRead() const;
void setIoCharactersActuallyRead(qlonglong number); ///< Number of bytes which this process really did cause to be fetched from the storage layer.
+
+ qlonglong ioCharactersActuallyWritten() const;
void setIoCharactersActuallyWritten(qlonglong number); ///< Attempt to count the number of bytes which this process caused to be sent to the storage layer.
+ long ioCharactersReadRate() const;
void setIoCharactersReadRate(long number); ///< The rate, in bytes per second, which this task has caused to be read from storage
+
+ long ioCharactersWrittenRate() const;
void setIoCharactersWrittenRate(long number); ///< The rate, in bytes per second, which this task has caused, or shall cause to be written to disk.
+
+ long ioReadSyscallsRate() const;
void setIoReadSyscallsRate(long number); ///< Number of read I/O operations per second, i.e. syscalls like read() and pread().
+
+ long ioWriteSyscallsRate() const;
void setIoWriteSyscallsRate(long number); ///< Number of write I/O operations per second, i.e. syscalls like write() and pwrite().
+
+ long ioCharactersActuallyReadRate() const;
void setIoCharactersActuallyReadRate(long number); ///< Number of bytes per second which this process really did cause to be fetched from the storage layer.
+
+ long ioCharactersActuallyWrittenRate() const;
void setIoCharactersActuallyWrittenRate(long number); ///< Attempt to count the number of bytes per second which this process caused to be sent to the storage layer.
- /* The member variables are made to public for efficiency, but should only be read from. */
- QString login;
- qlonglong uid;
- qlonglong euid;
- qlonglong suid;
- qlonglong fsuid;
-
- qlonglong gid;
- qlonglong egid;
- qlonglong sgid;
- qlonglong fsgid;
-
- qlonglong tracerpid;
- QByteArray tty;
- qlonglong userTime;
- qlonglong sysTime;
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/processes.cpp
^
|
@@ -44,7 +44,7 @@
{
public:
Private(Processes *q_ptr) {
- mFakeProcess.parent = &mFakeProcess;
+ mFakeProcess.setParent(&mFakeProcess);
mAbstractProcesses = 0;
mHistoricProcesses = 0;
mIsLocalHost = true;
@@ -131,29 +131,29 @@
Process *parent = d->mProcesses.value(ppid, &d->mFakeProcess);
Q_ASSERT(parent); //even init has a non-null parent - the mFakeProcess
- if(ps->parent != parent) {
+ if(ps->parent() != parent) {
emit beginMoveProcess(ps, parent/*new parent*/);
//Processes has been reparented
Process *p = ps;
do {
- p = p->parent;
- p->numChildren--;
- } while (p->pid!= -1);
+ p = p->parent();
+ p->numChildren()--;
+ } while (p->pid()!= -1);
Q_ASSERT(ps != parent);
- ps->parent->children.removeAll(ps);
- ps->parent = parent; //the parent has changed
- parent->children.append(ps);
+ ps->parent()->children().removeAll(ps);
+ ps->setParent(parent); //the parent has changed
+ parent->children().append(ps);
p = ps;
do {
- p = p->parent;
- p->numChildren++;
- } while (p->pid!= -1);
+ p = p->parent();
+ p->numChildren()++;
+ } while (p->pid()!= -1);
emit endMoveProcess();
Q_ASSERT(ps != parent);
- ps->parent = parent;
+ ps->setParent(parent);
}
- ps->parent_pid = ppid;
+ ps->setParentPid(ppid);
bool success = updateProcessInfo(ps);
emit processChanged(ps, false);
@@ -163,8 +163,8 @@
bool Processes::updateProcessInfo(Process *ps) {
//Now we can actually get the process info
- qlonglong oldUserTime = ps->userTime;
- qlonglong oldSysTime = ps->sysTime;
+ qlonglong oldUserTime = ps->userTime();
+ qlonglong oldSysTime = ps->sysTime();
qlonglong oldIoCharactersRead = 0;
qlonglong oldIoCharactersWritten = 0;
@@ -174,20 +174,20 @@
qlonglong oldIoCharactersActuallyWritten = 0;
if(d->mUpdateFlags.testFlag(Processes::IOStatistics)) {
- oldIoCharactersRead = ps->ioCharactersRead;
- oldIoCharactersWritten = ps->ioCharactersWritten;
- oldIoReadSyscalls = ps->ioReadSyscalls;
- oldIoWriteSyscalls = ps->ioWriteSyscalls;
- oldIoCharactersActuallyRead = ps->ioCharactersActuallyRead;
- oldIoCharactersActuallyWritten = ps->ioCharactersActuallyWritten;
+ oldIoCharactersRead = ps->ioCharactersRead();
+ oldIoCharactersWritten = ps->ioCharactersWritten();
+ oldIoReadSyscalls = ps->ioReadSyscalls();
+ oldIoWriteSyscalls = ps->ioWriteSyscalls();
+ oldIoCharactersActuallyRead = ps->ioCharactersActuallyRead();
+ oldIoCharactersActuallyWritten = ps->ioCharactersActuallyWritten();
}
- ps->changes = Process::Nothing;
+ ps->setChanges(Process::Nothing);
bool success;
if(d->mUsingHistoricalData)
- success = d->mHistoricProcesses->updateProcessInfo(ps->pid, ps);
+ success = d->mHistoricProcesses->updateProcessInfo(ps->pid(), ps);
else
- success = d->mAbstractProcesses->updateProcessInfo(ps->pid, ps);
+ success = d->mAbstractProcesses->updateProcessInfo(ps->pid(), ps);
//Now we have the process info. Calculate the cpu usage and total cpu usage for itself and all its parents
if(!d->mUsingHistoricalData && d->mElapsedTimeMilliSeconds != 0) { //Update the user usage and sys usage
@@ -197,22 +197,22 @@
* correction where we get the amount of time elapsed since
* we start processing. This is because the processing itself
* can take a non-trivial amount of time. */
- int elapsedTime = ps->elapsedTimeMilliSeconds;
- ps->elapsedTimeMilliSeconds = d->mLastUpdated.elapsed();
- elapsedTime = ps->elapsedTimeMilliSeconds - elapsedTime + d->mElapsedTimeMilliSeconds;
+ int elapsedTime = ps->elapsedTimeMilliSeconds();
+ ps->setElapsedTimeMilliSeconds(d->mLastUpdated.elapsed());
+ elapsedTime = ps->elapsedTimeMilliSeconds() - elapsedTime + d->mElapsedTimeMilliSeconds;
if(elapsedTime) {
- ps->setUserUsage((int)(((ps->userTime - oldUserTime)*1000.0) / elapsedTime));
- ps->setSysUsage((int)(((ps->sysTime - oldSysTime)*1000.0) / elapsedTime));
+ ps->setUserUsage((int)(((ps->userTime() - oldUserTime)*1000.0) / elapsedTime));
+ ps->setSysUsage((int)(((ps->sysTime() - oldSysTime)*1000.0) / elapsedTime));
}
#endif
if(d->mUpdateFlags.testFlag(Processes::IOStatistics)) {
if( d->mHavePreviousIoValues ) {
- ps->setIoCharactersReadRate((ps->ioCharactersRead - oldIoCharactersRead) * 1000.0 / elapsedTime);
- ps->setIoCharactersWrittenRate((ps->ioCharactersWritten - oldIoCharactersWritten) * 1000.0 / elapsedTime);
- ps->setIoReadSyscallsRate((ps->ioReadSyscalls - oldIoReadSyscalls) * 1000.0 / elapsedTime);
- ps->setIoWriteSyscallsRate((ps->ioWriteSyscalls - oldIoWriteSyscalls) * 1000.0 / elapsedTime);
- ps->setIoCharactersActuallyReadRate((ps->ioCharactersActuallyRead - oldIoCharactersActuallyRead) * 1000.0 / elapsedTime);
- ps->setIoCharactersActuallyWrittenRate((ps->ioCharactersActuallyWritten - oldIoCharactersActuallyWritten) * 1000.0 / elapsedTime);
+ ps->setIoCharactersReadRate((ps->ioCharactersRead() - oldIoCharactersRead) * 1000.0 / elapsedTime);
+ ps->setIoCharactersWrittenRate((ps->ioCharactersWritten() - oldIoCharactersWritten) * 1000.0 / elapsedTime);
+ ps->setIoReadSyscallsRate((ps->ioReadSyscalls() - oldIoReadSyscalls) * 1000.0 / elapsedTime);
+ ps->setIoWriteSyscallsRate((ps->ioWriteSyscalls() - oldIoWriteSyscalls) * 1000.0 / elapsedTime);
+ ps->setIoCharactersActuallyReadRate((ps->ioCharactersActuallyRead() - oldIoCharactersActuallyRead) * 1000.0 / elapsedTime);
+ ps->setIoCharactersActuallyWrittenRate((ps->ioCharactersActuallyWritten() - oldIoCharactersActuallyWritten) * 1000.0 / elapsedTime);
} else
d->mHavePreviousIoValues = true;
} else if(d->mHavePreviousIoValues) {
@@ -226,15 +226,15 @@
}
}
if(d->mUsingHistoricalData || d->mElapsedTimeMilliSeconds != 0) {
- ps->setTotalUserUsage(ps->userUsage);
- ps->setTotalSysUsage(ps->sysUsage);
- if(ps->userUsage != 0 || ps->sysUsage != 0) {
- Process *p = ps->parent;
- while(p->pid != -1) {
- p->totalUserUsage += ps->userUsage;
- p->totalSysUsage += ps->sysUsage;
+ ps->setTotalUserUsage(ps->userUsage());
+ ps->setTotalSysUsage(ps->sysUsage());
+ if(ps->userUsage() != 0 || ps->sysUsage() != 0) {
+ Process *p = ps->parent();
+ while(p->pid() != -1) {
+ p->totalUserUsage() += ps->userUsage();
+ p->totalSysUsage() += ps->sysUsage();
emit processChanged(p, true);
- p = p->parent;
+ p = p->parent();
}
}
}
@@ -258,17 +258,17 @@
d->mProcesses.insert(pid, ps);
- ps->index = d->mListProcesses.count();
+ ps->setIndex(d->mListProcesses.count());
d->mListProcesses.append(ps);
- ps->parent->children.append(ps);
+ ps->parent()->children().append(ps);
Process *p = ps;
do {
Q_ASSERT(p);
- p = p->parent;
- p->numChildren++;
- } while (p->pid != -1);
- ps->parent_pid = ppid;
+ p = p->parent();
+ p->numChildren()++;
+ } while (p->pid() != -1);
+ ps->setParentPid(ppid);
//Now we can actually get the process info
bool success = updateProcessInfo(ps);
@@ -364,7 +364,7 @@
Process *process = mProcesses.value(pid);
if(!process)
return;
- process->status = Process::Ended;
+ process->setStatus(Process::Ended);
emit q->processChanged(process, false);
}
void Processes::deleteProcess(long pid)
@@ -374,30 +374,30 @@
Process *process = d->mProcesses.value(pid);
if(!process)
return;
- Q_FOREACH( Process *it, process->children) {
- d->mProcessedLastTime.remove(it->pid);
- deleteProcess(it->pid);
+ Q_FOREACH( Process *it, process->children()) {
+ d->mProcessedLastTime.remove(it->pid());
+ deleteProcess(it->pid());
}
emit beginRemoveProcess(process);
d->mProcesses.remove(pid);
d->mListProcesses.removeAll(process);
- process->parent->children.removeAll(process);
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/processes.h
^
|
@@ -28,7 +28,6 @@
namespace KSysGuard
{
- class AbstractProcesses;
/**
* This class retrieves the processes currently running in an OS independent way.
*
@@ -41,7 +40,7 @@
* KSysGuard::Processes *processes = new KSysGuard::Processes()
* QHash<long, Process *> processlist = processes->getProcesses();
* foreach( Process * process, processlist) {
- * kDebug() << "Process with pid " << process->pid << " is called " << process->name;
+ * kDebug() << "Process with pid " << process->pid() << " is called " << process->name;
* }
* delete processes;
* processes = NULL;
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/processes_atop_p.cpp
^
|
@@ -223,7 +223,7 @@
if(index < 0)
return false;
PStat &p = d->pstats[index];
- process->parent_pid = p.gen.ppid;
+ process->setParentPid(p.gen.ppid);
process->setUid(p.gen.ruid);
process->setEuid(p.gen.ruid);
process->setSuid(p.gen.ruid);
@@ -237,16 +237,16 @@
// process->setTty
process->setUserTime(p.cpu.utime * 100/d->rh.hertz);//check - divide by interval maybe?
process->setSysTime(p.cpu.stime * 100/d->rh.hertz); //check
- process->setUserUsage( process->userTime / d->rr.interval );
- process->setSysUsage( process->sysTime / d->rr.interval );
+ process->setUserUsage(process->userTime() / d->rr.interval);
+ process->setSysUsage(process->sysTime() / d->rr.interval);
process->setNiceLevel(p.cpu.nice);
// process->setscheduler(p.cpu.policy);
process->setVmSize(p.mem.vmem);
process->setVmRSS(p.mem.rmem);
- process->vmSizeChange = p.mem.vgrow;
- process->vmRSSChange = p.mem.rgrow;
+ process->vmSizeChange() = p.mem.vgrow;
+ process->vmRSSChange() = p.mem.rgrow;
process->setVmURSS(0);
- process->vmURSSChange = 0;
+ process->vmURSSChange() = 0;
/* Fill in name and command */
QString name = QString::fromUtf8(p.gen.name, qstrnlen(p.gen.name,PNAMLEN));
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/processes_base_p.h
^
|
@@ -67,7 +67,7 @@
*
* This will be called for every PID, after getParentPid() has been called for the same parameter.
*
- * The process->pid process->ppid and process->parent are all guaranteed
+ * The process->pid() process->ppid and process->parent are all guaranteed
* to be filled in correctly and process->parent will be non null.
*/
virtual bool updateProcessInfo(long pid, Process *process) = 0;
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/processes_linux_p.cpp
^
|
@@ -134,10 +134,10 @@
if(!mFile.open(QIODevice::ReadOnly))
return false; /* process has terminated in the meantime */
- process->uid = 0;
- process->gid = 0;
- process->tracerpid = -1;
- process->numThreads = 0;
+ process->setUid(0);
+ process->setGid(0);
+ process->setTracerpid(-1);
+ process->setNumThreads(0);
int size;
int found = 0; //count how many fields we found
@@ -145,28 +145,41 @@
switch( mBuffer[0]) {
case 'N':
if((unsigned int)size > sizeof("Name:") && qstrncmp(mBuffer, "Name:", sizeof("Name:")-1) == 0) {
- if(process->command.isEmpty())
+ if(process->command().isEmpty())
process->setName(QString::fromLocal8Bit(mBuffer + sizeof("Name:")-1, size-sizeof("Name:")+1).trimmed());
if(++found == 5) goto finish;
}
break;
case 'U':
if((unsigned int)size > sizeof("Uid:") && qstrncmp(mBuffer, "Uid:", sizeof("Uid:")-1) == 0) {
- sscanf(mBuffer + sizeof("Uid:") -1, "%Ld %Ld %Ld %Ld", &process->uid, &process->euid, &process->suid, &process->fsuid );
+ qlonglong uid;
+ qlonglong euid;
+ qlonglong suid;
+ qlonglong fsuid;
+ sscanf(mBuffer + sizeof("Uid:") -1, "%Ld %Ld %Ld %Ld", &uid, &euid, &suid, &fsuid);
+ process->setUid(uid);
+ process->setEuid(euid);
+ process->setSuid(suid);
+ process->setFsuid(fsuid);
if(++found == 5) goto finish;
}
break;
case 'G':
if((unsigned int)size > sizeof("Gid:") && qstrncmp(mBuffer, "Gid:", sizeof("Gid:")-1) == 0) {
- sscanf(mBuffer + sizeof("Gid:")-1, "%Ld %Ld %Ld %Ld", &process->gid, &process->egid, &process->sgid, &process->fsgid );
+ qlonglong gid, egid, sgid, fsgid;
+ sscanf(mBuffer + sizeof("Gid:")-1, "%Ld %Ld %Ld %Ld", &gid, &egid, &sgid, &fsgid);
+ process->setGid(gid);
+ process->setEgid(egid);
+ process->setSgid(sgid);
+ process->setFsgid(fsgid);
if(++found == 5) goto finish;
}
break;
case 'T':
if((unsigned int)size > sizeof("TracerPid:") && qstrncmp(mBuffer, "TracerPid:", sizeof("TracerPid:")-1) == 0) {
- process->tracerpid = atol(mBuffer + sizeof("TracerPid:")-1);
- if (process->tracerpid == 0)
- process->tracerpid = -1;
+ process->setTracerpid(atol(mBuffer + sizeof("TracerPid:")-1));
+ if (process->tracerpid() == 0)
+ process->setTracerpid(-1);
if(++found == 5) goto finish;
} else if((unsigned int)size > sizeof("Threads:") && qstrncmp(mBuffer, "Threads:", sizeof("Threads:")-1) == 0) {
process->setNumThreads(atol(mBuffer + sizeof("Threads:")-1));
@@ -286,6 +299,9 @@
case 18: //niceLevel
ps->setNiceLevel(atoi(word+1)); /*Or should we use getPriority instead? */
break;
+ case 21: // startTime
+ ps->setStartTime(atoll(word+1));
+ break;
case 22: //vmSize
vmSize = atoll(word+1);
break;
@@ -365,9 +381,9 @@
long shared = atol(word+1);
/* we use the rss - shared to find the amount of memory just this app uses */
- process->vmURSS = process->vmRSS - (shared * sysconf(_SC_PAGESIZE) / 1024);
+ process->setVmURSS(process->vmRSS() - (shared * sysconf(_SC_PAGESIZE) / 1024));
#else
- process->vmURSS = 0;
+ process->setVmURSS(0);
#endif
return true;
}
@@ -375,28 +391,28 @@
bool ProcessesLocal::Private::readProcCmdline(const QString &dir, Process *process)
{
- if(!process->command.isNull()) return true; //only parse the cmdline once. This function takes up 25% of the CPU time :-/
+ if(!process->command().isNull()) return true; //only parse the cmdline once. This function takes up 25% of the CPU time :-/
mFile.setFileName(dir + "cmdline");
if(!mFile.open(QIODevice::ReadOnly))
return false; /* process has terminated in the meantime */
QTextStream in(&mFile);
- process->command = in.readAll();
+ process->setCommand(in.readAll());
//cmdline separates parameters with the NULL character
- if(!process->command.isEmpty()) {
+ if(!process->command().isEmpty()) {
//extract non-truncated name from cmdline
- int zeroIndex = process->command.indexOf(QChar('\0'));
- int processNameStart = process->command.lastIndexOf(QChar('/'), zeroIndex);
+ int zeroIndex = process->command().indexOf(QChar('\0'));
+ int processNameStart = process->command().lastIndexOf(QChar('/'), zeroIndex);
if(processNameStart == -1)
processNameStart = 0;
else
processNameStart++;
- QString nameFromCmdLine = process->command.mid(processNameStart, zeroIndex - processNameStart);
- if(nameFromCmdLine.startsWith(process->name))
+ QString nameFromCmdLine = process->command().mid(processNameStart, zeroIndex - processNameStart);
+ if(nameFromCmdLine.startsWith(process->name()))
process->setName(nameFromCmdLine);
- process->command.replace('\0', ' ');
+ process->command().replace('\0', ' ');
}
mFile.close();
@@ -407,25 +423,25 @@
int sched = sched_getscheduler(pid);
switch(sched) {
case (SCHED_OTHER):
- process->scheduler = KSysGuard::Process::Other;
+ process->setScheduler(KSysGuard::Process::Other);
break;
case (SCHED_RR):
- process->scheduler = KSysGuard::Process::RoundRobin;
+ process->setScheduler(KSysGuard::Process::RoundRobin);
break;
case (SCHED_FIFO):
- process->scheduler = KSysGuard::Process::Fifo;
+ process->setScheduler(KSysGuard::Process::Fifo);
break;
#ifdef SCHED_IDLE
case (SCHED_IDLE):
- process->scheduler = KSysGuard::Process::SchedulerIdle;
+ process->setScheduler(KSysGuard::Process::SchedulerIdle);
#endif
#ifdef SCHED_BATCH
case (SCHED_BATCH):
- process->scheduler = KSysGuard::Process::Batch;
+ process->setScheduler(KSysGuard::Process::Batch);
break;
#endif
default:
- process->scheduler = KSysGuard::Process::Other;
+ process->setScheduler(KSysGuard::Process::Other);
}
if(sched == SCHED_FIFO || sched == SCHED_RR) {
struct sched_param param;
@@ -438,12 +454,12 @@
#ifdef HAVE_IONICE
int ioprio = ioprio_get(IOPRIO_WHO_PROCESS, pid); /* Returns from 0 to 7 for the iopriority, and -1 if there's an error */
if(ioprio == -1) {
- process->ioniceLevel = -1;
- process->ioPriorityClass = KSysGuard::Process::None;
+ process->setIoniceLevel(-1);
+ process->setIoPriorityClass(KSysGuard::Process::None);
return false; /* Error. Just give up. */
}
- process->ioniceLevel = ioprio & 0xff; /* Bottom few bits are the priority */
- process->ioPriorityClass = (KSysGuard::Process::IoPriorityClass)(ioprio >> IOPRIO_CLASS_SHIFT); /* Top few bits are the class */
+ process->setIoniceLevel(ioprio & 0xff); /* Bottom few bits are the priority */
+ process->setIoPriorityClass((KSysGuard::Process::IoPriorityClass)(ioprio >> IOPRIO_CLASS_SHIFT)); /* Top few bits are the class */
return true;
#else
return false; /* Do nothing, if we do not support this architecture */
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processcore/processes_solaris_p.cpp
^
|
@@ -108,7 +108,7 @@
process->uid = 0;
process->gid = 0;
process->tracerpid = -1;
- process->pid = pid;
+ process->pid() = pid;
if( read( fd, &psinfo, sizeof( psinfo_t )) != sizeof( psinfo_t )) {
close( fd );
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processui/CMakeLists.txt
^
|
@@ -56,8 +56,8 @@
endif()
set_target_properties(processui
- PROPERTIES VERSION ${PROJECT_VERSION}
- SOVERSION ${PROJECT_VERSION_MAJOR}
+ PROPERTIES VERSION ${KSYSGUARD_VERSION_STRING}
+ SOVERSION ${KSYSGUARD_SOVERSION}
EXPORT_NAME ProcessUi
)
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processui/ProcessFilter.cpp
^
|
@@ -57,16 +57,16 @@
Q_ASSERT(parent_process);
//}
}
- if(!model->isSimpleMode() && source_row >= parent_process->children.size()) {
- qCDebug(LIBKSYSGUARD) << "Serious error with data. Source row requested for a non existent row. Requested " << source_row << " of " << parent_process->children.size() << " for " << parent_process->pid;
+ if(!model->isSimpleMode() && source_row >= parent_process->children().size()) {
+ qCDebug(LIBKSYSGUARD) << "Serious error with data. Source row requested for a non existent row. Requested " << source_row << " of " << parent_process->children().size() << " for " << parent_process->pid();
return true;
}
- process = parent_process->children.at(source_row);
+ process = parent_process->children().at(source_row);
}
Q_ASSERT(process);
- long uid = process->uid;
- long euid = process->euid;
+ long uid = process->uid();
+ long euid = process->euid();
bool accepted = true;
switch(mFilter) {
@@ -83,19 +83,19 @@
break;
case OwnProcesses: {
long ownuid = getuid();
- if(uid != ownuid && process->suid != ownuid && process->fsuid != ownuid && euid != ownuid)
+ if(uid != ownuid && process->suid() != ownuid && process->fsuid() != ownuid && euid != ownuid)
accepted = false;
break;
}
case ProgramsOnly:
- if(process->tty.isEmpty()) {
- if(!model->hasGUIWindow(process->pid))
+ if(process->tty().isEmpty()) {
+ if(!model->hasGUIWindow(process->pid()))
accepted = false;
} else {
// login and getty kinda _are_ the tty, so I do not really count them as 'programs'. So make a special case and hide them
// Their ppid are 1 (init) so by checking we try to avoid false matches, and speed up checking overall
- QString name = process->name.section(' ', 0,0);
- if(process->parent_pid == 1 && (name == "login" || name.endsWith("getty")))
+ QString name = process->name().section(' ', 0,0);
+ if(process->parentPid() == 1 && (name == "login" || name.endsWith("getty")))
accepted = false;
}
break;
@@ -107,7 +107,7 @@
if(filterRegExp().isEmpty()) return true;
//Allow the user to search by PID
- if(QString::number(process->pid).contains(filterRegExp())) return true;
+ if(QString::number(process->pid()).contains(filterRegExp())) return true;
//None of our tests have rejected it. Pass it on to qsortfilterproxymodel's filter
if(QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent))
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processui/ProcessModel.cpp
^
|
@@ -24,6 +24,7 @@
#include "ProcessModel.h"
#include "ProcessModel_p.h"
+#include "timeutil.h"
#include "processcore/processes.h"
#include "processcore/process.h"
@@ -54,8 +55,6 @@
#include <sys/types.h>
#endif
-
-
#ifdef HAVE_XRES
#include <X11/extensions/XRes.h>
#endif
@@ -138,6 +137,7 @@
delete mProcesses;
mProcesses = NULL;
}
+
ProcessModel::ProcessModel(QObject* parent, const QString &host)
: QAbstractItemModel(parent), d(new ProcessModelPrivate)
{
@@ -161,8 +161,6 @@
#endif
d->mUnits = UnitsKB;
d->mIoUnits = UnitsKB;
-
-
}
bool ProcessModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
@@ -185,117 +183,120 @@
We then sort by cpu usage to sort by that, then finally sort by memory usage */
/* First, place traced processes at the very top, ignoring any other sorting criteria */
- if(processLeft->tracerpid >= 0)
+ if(processLeft->tracerpid() >= 0)
return true;
- if(processRight->tracerpid >= 0)
+ if(processRight->tracerpid() >= 0)
return false;
/* Sort by username. First group into own user, normal users, system users */
- if(processLeft->uid != processRight->uid) {
+ if(processLeft->uid() != processRight->uid()) {
//We primarily sort by username
if(d->mIsLocalhost) {
int ownUid = getuid();
- if(processLeft->uid == ownUid)
+ if(processLeft->uid() == ownUid)
return true; //Left is our user, right is not. So left is above right
- if(processRight->uid == ownUid)
+ if(processRight->uid() == ownUid)
return false; //Left is not our user, right is. So right is above left
}
- bool isLeftSystemUser = processLeft->uid < 100 || !canUserLogin(processLeft->uid);
- bool isRightSystemUser = processRight->uid < 100 || !canUserLogin(processRight->uid);
+ bool isLeftSystemUser = processLeft->uid() < 100 || !canUserLogin(processLeft->uid());
+ bool isRightSystemUser = processRight->uid() < 100 || !canUserLogin(processRight->uid());
if(isLeftSystemUser && !isRightSystemUser)
return false; //System users are less than non-system users
if(!isLeftSystemUser && isRightSystemUser)
return true;
//They are either both system users, or both non-system users.
//So now sort by username
- return d->getUsernameForUser(processLeft->uid, false) < d->getUsernameForUser(processRight->uid, false);
+ return d->getUsernameForUser(processLeft->uid(), false) < d->getUsernameForUser(processRight->uid(), false);
}
/* 2nd sort order - Graphics Windows */
//Both columns have the same user. Place processes with windows at the top
- if(processLeft->hasManagedGuiWindow && !processRight->hasManagedGuiWindow)
+ if(processLeft->hasManagedGuiWindow() && !processRight->hasManagedGuiWindow())
return true;
- if(!processLeft->hasManagedGuiWindow && processRight->hasManagedGuiWindow)
+ if(!processLeft->hasManagedGuiWindow() && processRight->hasManagedGuiWindow())
return false;
/* 3rd sort order - CPU Usage */
int leftCpu, rightCpu;
if(d->mSimple || !d->mShowChildTotals) {
- leftCpu = processLeft->userUsage + processLeft->sysUsage;
- rightCpu = processRight->userUsage + processRight->sysUsage;
+ leftCpu = processLeft->userUsage() + processLeft->sysUsage();
+ rightCpu = processRight->userUsage() + processRight->sysUsage();
} else {
- leftCpu = processLeft->totalUserUsage + processLeft->totalSysUsage;
- rightCpu = processRight->totalUserUsage + processRight->totalSysUsage;
+ leftCpu = processLeft->totalUserUsage() + processLeft->totalSysUsage();
+ rightCpu = processRight->totalUserUsage() + processRight->totalSysUsage();
}
if(leftCpu != rightCpu)
return leftCpu > rightCpu;
/* 4th sort order - Memory Usage */
- qlonglong memoryLeft = (processLeft->vmURSS != -1)?processLeft->vmURSS:processLeft->vmRSS;
- qlonglong memoryRight = (processRight->vmURSS != -1)?processRight->vmURSS:processRight->vmRSS;
+ qlonglong memoryLeft = (processLeft->vmURSS() != -1) ? processLeft->vmURSS() : processLeft->vmRSS();
+ qlonglong memoryRight = (processRight->vmURSS() != -1) ? processRight->vmURSS() : processRight->vmRSS();
return memoryLeft > memoryRight;
}
case HeadingCPUUsage: {
int leftCpu, rightCpu;
if(d->mSimple || !d->mShowChildTotals) {
- leftCpu = processLeft->userUsage + processLeft->sysUsage;
- rightCpu = processRight->userUsage + processRight->sysUsage;
+ leftCpu = processLeft->userUsage() + processLeft->sysUsage();
+ rightCpu = processRight->userUsage() + processRight->sysUsage();
} else {
- leftCpu = processLeft->totalUserUsage + processLeft->totalSysUsage;
- rightCpu = processRight->totalUserUsage + processRight->totalSysUsage;
+ leftCpu = processLeft->totalUserUsage() + processLeft->totalSysUsage();
+ rightCpu = processRight->totalUserUsage() + processRight->totalSysUsage();
}
return leftCpu > rightCpu;
}
case HeadingCPUTime: {
- return (processLeft->userTime + processLeft->sysTime) > (processRight->userTime + processRight->sysTime);
+ return (processLeft->userTime() + processLeft->sysTime()) > (processRight->userTime() + processRight->sysTime());
}
case HeadingMemory: {
- qlonglong memoryLeft = (processLeft->vmURSS != -1)?processLeft->vmURSS:processLeft->vmRSS;
- qlonglong memoryRight = (processRight->vmURSS != -1)?processRight->vmURSS:processRight->vmRSS;
+ qlonglong memoryLeft = (processLeft->vmURSS() != -1) ? processLeft->vmURSS() : processLeft->vmRSS();
+ qlonglong memoryRight = (processRight->vmURSS() != -1) ? processRight->vmURSS() : processRight->vmRSS();
return memoryLeft > memoryRight;
}
+ case HeadingStartTime: {
+ return processLeft->startTime() > processRight->startTime();
+ }
case HeadingXMemory:
- return processLeft->pixmapBytes > processRight->pixmapBytes;
+ return processLeft->pixmapBytes() > processRight->pixmapBytes();
case HeadingVmSize:
- return processLeft->vmSize > processRight->vmSize;
+ return processLeft->vmSize() > processRight->vmSize();
case HeadingSharedMemory: {
- qlonglong memoryLeft = (processLeft->vmURSS != -1)?processLeft->vmRSS - processLeft->vmURSS:0;
- qlonglong memoryRight = (processRight->vmURSS != -1)?processRight->vmRSS - processRight->vmURSS:0;
+ qlonglong memoryLeft = (processLeft->vmURSS() != -1) ? processLeft->vmRSS() - processLeft->vmURSS() : 0;
+ qlonglong memoryRight = (processRight->vmURSS() != -1) ? processRight->vmRSS() - processRight->vmURSS() : 0;
return memoryLeft > memoryRight;
}
case HeadingPid:
- return processLeft->pid > processRight->pid;
+ return processLeft->pid() > processRight->pid();
case HeadingNiceness:
//Sort by scheduler first
- if(processLeft->scheduler != processRight->scheduler) {
- if(processLeft->scheduler == KSysGuard::Process::RoundRobin || processLeft->scheduler == KSysGuard::Process::Fifo)
+ if(processLeft->scheduler() != processRight->scheduler()) {
+ if(processLeft->scheduler() == KSysGuard::Process::RoundRobin || processLeft->scheduler() == KSysGuard::Process::Fifo)
return true;
- if(processRight->scheduler == KSysGuard::Process::RoundRobin || processRight->scheduler == KSysGuard::Process::Fifo)
+ if(processRight->scheduler() == KSysGuard::Process::RoundRobin || processRight->scheduler() == KSysGuard::Process::Fifo)
return false;
- if(processLeft->scheduler == KSysGuard::Process::Other)
+ if(processLeft->scheduler() == KSysGuard::Process::Other)
return true;
- if(processRight->scheduler == KSysGuard::Process::Other)
+ if(processRight->scheduler() == KSysGuard::Process::Other)
return false;
- if(processLeft->scheduler == KSysGuard::Process::Batch)
+ if(processLeft->scheduler() == KSysGuard::Process::Batch)
return true;
}
- if(processLeft->niceLevel == processRight->niceLevel)
- return processLeft->pid < processRight->pid; //Subsort by pid if the niceLevel is the same
- return processLeft->niceLevel < processRight->niceLevel;
+ if(processLeft->niceLevel() == processRight->niceLevel())
+ return processLeft->pid() < processRight->pid(); //Subsort by pid if the niceLevel is the same
+ return processLeft->niceLevel() < processRight->niceLevel();
case HeadingTty: {
- if( processLeft->tty == processRight->tty)
- return processLeft->pid < processRight->pid; //Both ttys are the same. Sort by pid
- if(processLeft->tty.isEmpty())
+ if(processLeft->tty() == processRight->tty())
+ return processLeft->pid() < processRight->pid(); //Both ttys are the same. Sort by pid
+ if(processLeft->tty().isEmpty())
return false; //Only left is empty (since they aren't the same)
- else if(processRight->tty.isEmpty())
+ else if(processRight->tty().isEmpty())
return true; //Only right is empty
//Neither left or right is empty. The tty string is like "tty10" so split this into "tty" and "10"
//and sort by the string first, then sort by the number
QRegExp regexpLeft("^(\\D*)(\\d*)$");
QRegExp regexpRight(regexpLeft);
- if(regexpLeft.indexIn(processLeft->tty) == -1 || regexpRight.indexIn(processRight->tty) == -1)
- return processLeft->tty < processRight->tty;
+ if(regexpLeft.indexIn(processLeft->tty()) == -1 || regexpRight.indexIn(processRight->tty()) == -1)
+ return processLeft->tty() < processRight->tty();
int nameMatch = regexpLeft.cap(1).compare(regexpRight.cap(1));
if(nameMatch < 0)
return true;
@@ -306,33 +307,33 @@
case HeadingIoRead:
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processui/ProcessModel.h
^
|
@@ -132,8 +132,24 @@
* setup header function, and make sure you increase PROCESSHEADERVERSION. This will ensure
* that old saved settings won't be used
*/
-#define PROCESSHEADERVERSION 5
- enum { HeadingName=0, HeadingUser, HeadingPid, HeadingTty, HeadingNiceness, HeadingCPUUsage, HeadingCPUTime, HeadingIoRead, HeadingIoWrite, HeadingVmSize, HeadingMemory, HeadingSharedMemory, HeadingCommand, HeadingXMemory, HeadingXTitle };
+#define PROCESSHEADERVERSION 6
+ enum { HeadingName=0,
+ HeadingUser,
+ HeadingPid,
+ HeadingTty,
+ HeadingNiceness,
+ HeadingCPUUsage,
+ HeadingCPUTime,
+ HeadingIoRead,
+ HeadingIoWrite,
+ HeadingVmSize,
+ HeadingMemory,
+ HeadingSharedMemory,
+ HeadingStartTime,
+ HeadingCommand,
+ HeadingXMemory,
+ HeadingXTitle
+ };
enum { UidRole = Qt::UserRole, SortingValueRole, WindowIdRole, PlainValueRole, PercentageRole };
@@ -186,3 +202,4 @@
#endif
+
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processui/ksysguardprocesslist.cpp
^
|
@@ -285,6 +285,7 @@
d->mUi->treeView->header()->hideSection(ProcessModel::HeadingVmSize);
d->mUi->treeView->header()->hideSection(ProcessModel::HeadingNiceness);
d->mUi->treeView->header()->hideSection(ProcessModel::HeadingTty);
+ d->mUi->treeView->header()->hideSection(ProcessModel::HeadingStartTime);
d->mUi->treeView->header()->hideSection(ProcessModel::HeadingCommand);
d->mUi->treeView->header()->hideSection(ProcessModel::HeadingPid);
d->mUi->treeView->header()->hideSection(ProcessModel::HeadingCPUTime);
@@ -447,7 +448,7 @@
//If the selected process is a zombie, do not bother offering renice and kill options
- bool showSignalingEntries = numProcesses != 1 || process->status != KSysGuard::Process::Zombie;
+ bool showSignalingEntries = numProcesses != 1 || process->status() != KSysGuard::Process::Zombie;
if(showSignalingEntries) {
d->mProcessContextMenu->addAction(d->renice);
QMenu *signalMenu = d->mProcessContextMenu->addMenu(i18n("Send Signal"));
@@ -461,19 +462,19 @@
signalMenu->addAction(d->sigUsr2);
}
- if(numProcesses == 1 && process->parent_pid > 1) {
+ if(numProcesses == 1 && process->parentPid() > 1) {
//As a design decision, I do not show the 'Jump to parent process' option when the
//parent is just 'init'.
- KSysGuard::Process *parent_process = d->mModel.getProcess(process->parent_pid);
+ KSysGuard::Process *parent_process = d->mModel.getProcess(process->parentPid());
if(parent_process) { //it should not be possible for this process to not exist, but check just incase
- QString parent_name = parent_process->name;
+ QString parent_name = parent_process->name();
d->selectParent->setText(i18n("Jump to Parent Process (%1)", parent_name));
d->mProcessContextMenu->addAction(d->selectParent);
}
}
- if(numProcesses == 1 && process->tracerpid >= 0) {
+ if(numProcesses == 1 && process->tracerpid() >= 0) {
//If the process is being debugged, offer to select it
d->mProcessContextMenu->addAction(d->selectTracer);
}
@@ -482,7 +483,7 @@
d->mProcessContextMenu->addAction(d->window);
}
- if(numProcesses == 1 && process->status == KSysGuard::Process::Stopped) {
+ if(numProcesses == 1 && process->status() == KSysGuard::Process::Stopped) {
//If the process is stopped, offer to resume it
d->mProcessContextMenu->addAction(d->resume);
}
@@ -495,7 +496,7 @@
if (showSignalingEntries) {
d->mProcessContextMenu->addSeparator();
d->mProcessContextMenu->addAction(d->terminate);
- if (numProcesses == 1 && !process->timeKillWasSent.isNull())
+ if (numProcesses == 1 && !process->timeKillWasSent().isNull())
d->mProcessContextMenu->addAction(d->kill);
}
@@ -522,7 +523,7 @@
QModelIndex realIndex = d->mFilterModel.mapToSource(selectedIndexes.at(0));
KSysGuard::Process *process = reinterpret_cast<KSysGuard::Process *> (realIndex.internalPointer());
if(process)
- selectAndJumpToProcess(process->parent_pid);
+ selectAndJumpToProcess(process->parentPid());
} else if(result == d->selectTracer) {
QModelIndexList selectedIndexes = d->mUi->treeView->selectionModel()->selectedRows();
int numProcesses = selectedIndexes.size();
@@ -530,7 +531,7 @@
QModelIndex realIndex = d->mFilterModel.mapToSource(selectedIndexes.at(0));
KSysGuard::Process *process = reinterpret_cast<KSysGuard::Process *> (realIndex.internalPointer());
if(process)
- selectAndJumpToProcess(process->tracerpid);
+ selectAndJumpToProcess(process->tracerpid());
} else if(result == d->window) {
QModelIndexList selectedIndexes = d->mUi->treeView->selectionModel()->selectedRows();
int numProcesses = selectedIndexes.size();
@@ -1066,16 +1067,16 @@
int sched = -2;
int iosched = -2;
foreach(KSysGuard::Process *process, processes) {
- pids << process->pid;
+ pids << process->pid();
selectedAsStrings << d->mModel.getStringForProcess(process);
- if(sched == -2) sched = (int)process->scheduler;
- else if(sched != -1 && sched != (int)process->scheduler) sched = -1; //If two processes have different schedulers, disable the cpu scheduler stuff
- if(iosched == -2) iosched = (int)process->ioPriorityClass;
- else if(iosched != -1 && iosched != (int)process->ioPriorityClass) iosched = -1; //If two processes have different schedulers, disable the cpu scheduler stuff
+ if(sched == -2) sched = (int)process->scheduler();
+ else if(sched != -1 && sched != (int)process->scheduler()) sched = -1; //If two processes have different schedulers, disable the cpu scheduler stuff
+ if(iosched == -2) iosched = (int)process->ioPriorityClass();
+ else if(iosched != -1 && iosched != (int)process->ioPriorityClass()) iosched = -1; //If two processes have different schedulers, disable the cpu scheduler stuff
}
- int firstPriority = processes.first()->niceLevel;
- int firstIOPriority = processes.first()->ioniceLevel;
+ int firstPriority = processes.first()->niceLevel();
+ int firstIOPriority = processes.first()->ioniceLevel();
bool supportsIoNice = d->mModel.processController()->supportsIoNiceness();
if(!supportsIoNice) { iosched = -2; firstIOPriority = -2; }
@@ -1103,16 +1104,16 @@
break; //So do nothing
case KSysGuard::Process::Other:
case KSysGuard::Process::Fifo:
- if(reniceDlg->newCPUSched != (int)process->scheduler) {
+ if(reniceDlg->newCPUSched != (int)process->scheduler()) {
changeCPUSchedulerPids << pid;
renicePids << pid;
- } else if(reniceDlg->newCPUPriority != process->niceLevel)
+ } else if(reniceDlg->newCPUPriority != process->niceLevel())
renicePids << pid;
break;
case KSysGuard::Process::RoundRobin:
case KSysGuard::Process::Batch:
- if(reniceDlg->newCPUSched != (int)process->scheduler || reniceDlg->newCPUPriority != process->niceLevel) {
+ if(reniceDlg->newCPUSched != (int)process->scheduler() || reniceDlg->newCPUPriority != process->niceLevel()) {
changeCPUSchedulerPids << pid;
}
break;
@@ -1122,22 +1123,22 @@
case -1: //Invalid, not changed etc.
break; //So do nothing
case KSysGuard::Process::None:
- if(reniceDlg->newIOSched != (int)process->ioPriorityClass) {
+ if(reniceDlg->newIOSched != (int)process->ioPriorityClass()) {
// Unfortunately linux doesn't actually let us set the ioniceness back to none after being set to something else
- if(process->ioPriorityClass != KSysGuard::Process::BestEffort || reniceDlg->newIOPriority != process->ioniceLevel)
+ if(process->ioPriorityClass() != KSysGuard::Process::BestEffort || reniceDlg->newIOPriority != process->ioniceLevel())
changeIOSchedulerPids << pid;
}
break;
case KSysGuard::Process::Idle:
- if(reniceDlg->newIOSched != (int)process->ioPriorityClass) {
+ if(reniceDlg->newIOSched != (int)process->ioPriorityClass()) {
changeIOSchedulerPids << pid;
}
break;
case KSysGuard::Process::BestEffort:
- if(process->ioPriorityClass == KSysGuard::Process::None && reniceDlg->newIOPriority == (process->niceLevel + 20)/5)
+ if(process->ioPriorityClass() == KSysGuard::Process::None && reniceDlg->newIOPriority == (process->niceLevel() + 20)/5)
break; //Don't set to BestEffort if it's on None and the nicelevel wouldn't change
case KSysGuard::Process::RealTime:
- if(reniceDlg->newIOSched != (int)process->ioPriorityClass || reniceDlg->newIOPriority != process->ioniceLevel) {
+ if(reniceDlg->newIOSched != (int)process->ioPriorityClass() || reniceDlg->newIOPriority != process->ioniceLevel()) {
changeIOSchedulerPids << pid;
}
break;
@@ -1275,7 +1276,7 @@
QList<KSysGuard::Process *> processes = selectedProcesses();
foreach(KSysGuard::Process *process, processes) {
- selectedPids << process->pid;
+ selectedPids << process->pid();
if (!confirm)
continue;
QString name = d->mModel.getStringForProcess(process);
@@ -1326,7 +1327,7 @@
foreach (long long pid, selectedPids) {
KSysGuard::Process *process = d->mModel.getProcess(pid);
if (process)
- process->timeKillWasSent.start();
+ process->timeKillWasSent().start();
d->mUi->treeView->selectionModel()->clearSelection();
}
}
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processui/scripting.cpp
^
|
@@ -49,9 +49,9 @@
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Close);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotClose()));
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotClose())); // NOTE 2015-01-25: no such slot
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotClose()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotClose())); // NOTE 2015-01-25: no such slot
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *layout = new QVBoxLayout;
@@ -109,7 +109,7 @@
QUrl fileName = QUrl::fromLocalFile(path + "index.html");
if(!mScriptingHtmlDialog) {
mScriptingHtmlDialog = new ScriptingHtmlDialog(this);
- connect(mScriptingHtmlDialog, SIGNAL(closeClicked()), SLOT(stopAllScripts()));
+ connect(mScriptingHtmlDialog, SIGNAL(closeClicked()), SLOT(stopAllScripts())); // NOTE 2015-01-25: no such signal
QAction *refreshAction = new QAction("refresh", mScriptingHtmlDialog);
refreshAction->setShortcut(QKeySequence::Refresh);
@@ -200,7 +200,7 @@
QList<KSysGuard::Process *> selectedProcesses = mProcessList->selectedProcesses();
if(selectedProcesses.isEmpty())
return;
- mPid = selectedProcesses[0]->pid;
+ mPid = selectedProcesses[0]->pid();
runScript(path, action->text());
}
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/processui/scripting.h
^
|
@@ -71,20 +71,21 @@
qlonglong mPid;
};
-#define PROPERTY(Type,Name) Type Name() const { KSysGuard::Process *process = mModel->getProcess(mPid); if(process) return process->Name; else return Type();}
+
+#define PROPERTY(Type,Name) Type Name() const { KSysGuard::Process *process = mModel->getProcess(mPid); if(process) return process->Name(); else return Type();}
class ProcessObject : public QObject {
Q_OBJECT
public:
Q_PROPERTY(qlonglong pid READ pid WRITE setPid) /* Add functionality to 'set' the pid to change which process to read from */
- Q_PROPERTY(qlonglong ppid READ parent_pid) /* Map 'ppid' to 'parent_pid' to give it a nicer scripting name */
+ Q_PROPERTY(qlonglong ppid READ parentPid) /* Map 'ppid' to 'parentPid' to give it a nicer scripting name */
Q_PROPERTY(QString name READ name) /* Defined below to return the first word of the name */
Q_PROPERTY(QString fullname READ fullname) /* Defined below to return 'name' */
Q_PROPERTY(qlonglong rss READ vmRSS) /* Map 'rss' to 'vmRSS' just to give it a nicer scripting name */
Q_PROPERTY(qlonglong urss READ vmURSS) /* Map 'urss' to 'vmURSS' just to give it a nicer scripting name */
Q_PROPERTY(int numThreads READ numThreads) PROPERTY(int, numThreads)
Q_PROPERTY(qlonglong fsgid READ fsgid) PROPERTY(qlonglong, fsgid)
- Q_PROPERTY(qlonglong parent_pid READ parent_pid) PROPERTY(qlonglong, parent_pid)
+ Q_PROPERTY(qlonglong parentPid READ parentPid) PROPERTY(qlonglong, parentPid)
Q_PROPERTY(QString login READ login) PROPERTY(QString, login)
Q_PROPERTY(qlonglong uid READ uid) PROPERTY(qlonglong, uid)
Q_PROPERTY(qlonglong euid READ euid) PROPERTY(qlonglong, euid)
@@ -114,25 +115,25 @@
Q_PROPERTY(QString command READ command) PROPERTY(QString, command)
Q_PROPERTY(qlonglong status READ status) PROPERTY(qlonglong, status)
Q_PROPERTY(qlonglong ioCharactersRead READ ioCharactersRead) PROPERTY(qlonglong, ioCharactersRead)
- Q_PROPERTY(qlonglong ioCharactersWritten READ ioCharactersWritten) PROPERTY(qlonglong, ioCharactersWritten)
- Q_PROPERTY(qlonglong ioReadSyscalls READ ioReadSyscalls) PROPERTY(qlonglong, ioReadSyscalls)
- Q_PROPERTY(qlonglong ioWriteSyscalls READ ioWriteSyscalls) PROPERTY(qlonglong, ioWriteSyscalls)
+ Q_PROPERTY(qlonglong ioCharactersWritten READ ioCharactersWritten) PROPERTY(qlonglong, ioCharactersWritten)
+ Q_PROPERTY(qlonglong ioReadSyscalls READ ioReadSyscalls) PROPERTY(qlonglong, ioReadSyscalls)
+ Q_PROPERTY(qlonglong ioWriteSyscalls READ ioWriteSyscalls) PROPERTY(qlonglong, ioWriteSyscalls)
Q_PROPERTY(qlonglong ioCharactersActuallyRead READ ioCharactersActuallyRead) PROPERTY(qlonglong, ioCharactersActuallyRead)
Q_PROPERTY(qlonglong ioCharactersActuallyWritten READ ioCharactersActuallyWritten) PROPERTY(qlonglong, ioCharactersActuallyWritten)
Q_PROPERTY(qlonglong ioCharactersReadRate READ ioCharactersReadRate) PROPERTY(qlonglong, ioCharactersReadRate)
Q_PROPERTY(qlonglong ioCharactersWrittenRate READ ioCharactersWrittenRate) PROPERTY(qlonglong, ioCharactersWrittenRate)
Q_PROPERTY(qlonglong ioReadSyscallsRate READ ioReadSyscallsRate) PROPERTY(qlonglong, ioReadSyscallsRate)
Q_PROPERTY(qlonglong ioWriteSyscallsRate READ ioWriteSyscallsRate) PROPERTY(qlonglong, ioWriteSyscallsRate)
- Q_PROPERTY(qlonglong ioCharactersActuallyReadRate READ ioCharactersActuallyReadRate) PROPERTY(qlonglong, ioCharactersActuallyReadRate)
- Q_PROPERTY(qlonglong ioCharactersActuallyWrittenRate READ ioCharactersActuallyWrittenRate) PROPERTY(qlonglong, ioCharactersActuallyWrittenRate)
+ Q_PROPERTY(qlonglong ioCharactersActuallyReadRate READ ioCharactersActuallyReadRate) PROPERTY(qlonglong, ioCharactersActuallyReadRate)
+ Q_PROPERTY(qlonglong ioCharactersActuallyWrittenRate READ ioCharactersActuallyWrittenRate) PROPERTY(qlonglong, ioCharactersActuallyWrittenRate)
ProcessObject(ProcessModel * processModel, int pid);
void update(KSysGuard::Process *process);
int pid() const { return mPid; }
void setPid(int pid) { mPid = pid; }
- QString name() const { KSysGuard::Process *process = mModel->getProcess(mPid); if(process) return process->name.section(' ', 0,0); else return QString(); }
- QString fullname() const { KSysGuard::Process *process = mModel->getProcess(mPid); if(process) return process->name; else return QString(); }
+ QString name() const { KSysGuard::Process *process = mModel->getProcess(mPid); if(process) return process->name().section(' ', 0,0); else return QString(); }
+ QString fullname() const { KSysGuard::Process *process = mModel->getProcess(mPid); if(process) return process->name(); else return QString(); }
public Q_SLOTS:
bool fileExists(const QString &filename);
|
[-]
[+]
|
Added |
libksysguard-5.3.0.tar.xz/processui/timeutil.h
^
|
@@ -0,0 +1,85 @@
+/*
+ KSysGuard, the KDE System Guard
+
+ Copyright (C) 2014 Gregor Mi <codestruct@posteo.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef TIMEUTIL_H
+#define TIMEUTIL_H
+
+#include <cmath> // floor
+#include <time.h>
+
+#include <QDateTime>
+
+#include <klocalizedstring.h> // KF5::I18n
+
+class TimeUtil
+{
+public:
+ /**
+ * @Returns the amount of seconds passed since the system was booted
+ */
+ static long systemUptimeSeconds()
+ {
+ timespec tp;
+ int isSuccess = clock_gettime(CLOCK_MONOTONIC, &tp); // see http://stackoverflow.com/questions/8357073/get-uptime-in-seconds-or-miliseconds-on-unix-like-systems
+ Q_ASSERT(isSuccess == 0);
+ return tp.tv_sec;
+ }
+
+ /**
+ * @Returns the point in time when the system was booted
+ */
+ static QDateTime systemUptimeAbsolute()
+ {
+ auto now = QDateTime::currentDateTime();
+ return now.addSecs(-systemUptimeSeconds());
+ }
+
+ /**
+ * Converts the given @param seconds into a human readable string.
+ * It represents an elapsed time span, e.g. "3m 50s ago".
+ */
+ static QString secondsToHumanElapsedString(long seconds)
+ {
+ const int s_abs = seconds;
+ const int m_abs = floor(seconds / 60.0);
+ const int h_abs = floor(seconds / 60.0 / 60.0);
+ const int d_abs = floor(seconds / 60.0 / 60.0 / 24.0);
+
+ if (m_abs == 0) {
+ return i18nc("contains a abbreviated time unit: (s)econds", "%1s ago", s_abs);
+ } else if (h_abs == 0) {
+ const int s = s_abs - m_abs * 60;
+ return i18nc("contains abbreviated time units: (m)inutes and (s)econds", "%1m %2s ago", m_abs, s);
+ } else if (d_abs == 0) {
+ const int s = s_abs - m_abs * 60;
+ const int m = m_abs - h_abs * 60;
+ return i18nc("contains abbreviated time units: (h)ours, (m)inutes and (s)econds)", "%1h %2m %3s ago", h_abs, m, s);
+ } else { // d_abs > 0
+ const int m = m_abs - h_abs * 60;
+ const int h = h_abs - d_abs * 24;
+ return i18ncp("contains also abbreviated time units: (h)ours and (m)inutes",
+ "%1 day %2h %3m ago", "%1 days %2h %3m ago", d_abs, h, m);
+ }
+ }
+};
+
+#endif
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/scripts/smaps/smaps.desktop
^
|
@@ -1,7 +1,6 @@
[Desktop Entry]
Name=Detailed Memory Information
Name[ar]=معلومات مفصلة عن الذاكرة
-Name[ast]=Información detallada sobre la memoria
Name[bg]=Подробни данни за паметта
Name[bs]=Detaljni podaci o memoriji
Name[ca]=Informació detallada de la memòria
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/signalplotter/CMakeLists.txt
^
|
@@ -21,8 +21,8 @@
)
set_target_properties(ksignalplotter
- PROPERTIES VERSION ${PROJECT_VERSION}
- SOVERSION ${PROJECT_VERSION_MAJOR}
+ PROPERTIES VERSION ${KSYSGUARD_VERSION_STRING}
+ SOVERSION ${KSYSGUARD_SOVERSION}
EXPORT_NAME SignalPlotter
)
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/signalplotter/kgraphicssignalplotter.h
^
|
@@ -31,8 +31,6 @@
#include <QGraphicsWidget>
#include <klocalizedstring.h>
-class QPaintEvent;
-class QResizeEvent;
class QGraphicsSceneResizeEvent;
class KGraphicsSignalPlotterPrivate;
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/signalplotter/ksignalplotter.h
^
|
@@ -33,7 +33,6 @@
class QPaintEvent;
class QResizeEvent;
-class QGraphicsSceneResizeEvent;
class KSignalPlotterPrivate;
//Make sure only declare KLocalizedString once
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/tests/CMakeLists.txt
^
|
@@ -21,6 +21,10 @@
LINK_LIBRARIES KF5::SignalPlotter Qt5::Test Qt5::Widgets KF5::IconThemes
)
+ecm_add_test(chronotest.cpp
+ TEST_NAME chronotest
+ LINK_LIBRARIES Qt5::Test KF5::I18n
+)
# set( ksysguarddtest_SRCS ksysguarddtest.cpp ${libksysguard_SOURCE_DIR}/ksgrd/SensorAgent.cpp ${libksysguard_SOURCE_DIR}/ksgrd/SensorManager.cpp ${libksysguard_SOURCE_DIR}/ksgrd/SensorSocketAgent.cpp ${libksysguard_SOURCE_DIR}/ksgrd/SensorShellAgent.cpp)
#
@@ -34,5 +38,3 @@
# KF5::CoreAddons
# KF5::I18n
# )
-
-
|
[-]
[+]
|
Added |
libksysguard-5.3.0.tar.xz/tests/chronotest.cpp
^
|
@@ -0,0 +1,53 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Gregor Mi <codestruct@posteo.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <QtTest>
+#include <QtCore>
+#include <QDebug>
+
+#include "chronotest.h"
+#include <processui/timeutil.h>
+
+void testChrono::testTimeMethods() {
+ qDebug() << "TimeUtil::systemUptimeSeconds()" << TimeUtil::systemUptimeSeconds();
+ qDebug() << "TimeUtil::systemUptimeAbsolute()" << TimeUtil::systemUptimeAbsolute();
+}
+
+void testChrono::testsecondsToHumanString1()
+{
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(0), QString("0s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(1), QString("1s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(59), QString("59s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(1 * 60), QString("1m 0s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(1 * 60 + 1), QString("1m 1s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(1 * 60 + 59), QString("1m 59s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(2 * 60), QString("2m 0s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(59 * 60 + 59), QString("59m 59s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(1 * 60 * 60), QString("1h 0m 0s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(1 * 60 * 60 + 59 * 60 + 59), QString("1h 59m 59s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(2 * 60 * 60), QString("2h 0m 0s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(23 * 60 * 60 + 59 * 60 + 59), QString("23h 59m 59s ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(24 * 60 * 60), QString("1 day 0h 0m ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(25 * 60 * 60 + 59 * 60), QString("1 day 1h 59m ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(25 * 60 * 60 + 59 * 60 + 59), QString("1 day 1h 59m ago")); // seconds are omitted now
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(2 * 24 * 60 * 60), QString("2 days 0h 0m ago"));
+ QCOMPARE(TimeUtil::secondsToHumanElapsedString(10 * 24 * 60 * 60), QString("10 days 0h 0m ago"));
+}
+
+QTEST_MAIN(testChrono)
|
[-]
[+]
|
Added |
libksysguard-5.3.0.tar.xz/tests/chronotest.h
^
|
@@ -0,0 +1,33 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Gregor Mi <codestruct@posteo.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CHRONOTEST_H
+#define CHRONOTEST_H
+
+#include <QtCore/QObject>
+class testChrono : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testTimeMethods();
+ void testsecondsToHumanString1();
+};
+
+#endif
|
[-]
[+]
|
Changed |
libksysguard-5.3.0.tar.xz/tests/processtest.cpp
^
|
@@ -38,26 +38,26 @@
QList<KSysGuard::Process *> processes = processController->getAllProcesses();
QSet<long> pids;
Q_FOREACH( KSysGuard::Process *process, processes) {
- if(process->pid == 0) continue;
- QVERIFY(process->pid > 0);
- QVERIFY(!process->name.isEmpty());
+ if(process->pid() == 0) continue;
+ QVERIFY(process->pid() > 0);
+ QVERIFY(!process->name().isEmpty());
//test all the pids are unique
- QVERIFY(!pids.contains(process->pid));
- pids.insert(process->pid);
+ QVERIFY(!pids.contains(process->pid()));
+ pids.insert(process->pid());
}
processController->updateAllProcesses();
QList<KSysGuard::Process *> processes2 = processController->getAllProcesses();
Q_FOREACH( KSysGuard::Process *process, processes2) {
- if(process->pid == 0) continue;
- QVERIFY(process->pid > 0);
- QVERIFY(!process->name.isEmpty());
+ if(process->pid() == 0) continue;
+ QVERIFY(process->pid() > 0);
+ QVERIFY(!process->name().isEmpty());
//test all the pids are unique
- if(!pids.contains(process->pid)) {
- qCDebug(LIBKSYSGUARD) << process->pid << " not found. " << process->name;
+ if(!pids.contains(process->pid())) {
+ qCDebug(LIBKSYSGUARD) << process->pid() << " not found. " << process->name();
}
- pids.remove(process->pid);
+ pids.remove(process->pid());
}
QVERIFY(processes2.size() == processes.size());
@@ -67,9 +67,9 @@
unsigned long testProcess::countNumChildren(KSysGuard::Process *p) {
- unsigned long total = p->children.size();
- for(int i =0; i < p->children.size(); i++) {
- total += countNumChildren(p->children[i]);
+ unsigned long total = p->children().size();
+ for(int i =0; i < p->children().size(); i++) {
+ total += countNumChildren(p->children()[i]);
}
return total;
}
@@ -80,11 +80,11 @@
QList<KSysGuard::Process *> processes = processController->getAllProcesses();
Q_FOREACH( KSysGuard::Process *process, processes) {
- QCOMPARE(countNumChildren(process), process->numChildren);
+ QCOMPARE(countNumChildren(process), process->numChildren());
- for(int i =0; i < process->children.size(); i++) {
- QVERIFY(process->children[i]->parent);
- QCOMPARE(process->children[i]->parent, process);
+ for(int i =0; i < process->children().size(); i++) {
+ QVERIFY(process->children()[i]->parent());
+ QCOMPARE(process->children()[i]->parent(), process);
}
}
delete processController;
@@ -96,20 +96,20 @@
processController->updateAllProcesses();
KSysGuard::Process *initProcess = processController->getProcess(1);
- if(!initProcess || initProcess->numChildren < 3) {
+ if(!initProcess || initProcess->numChildren() < 3) {
delete processController;
return;
}
QVERIFY(initProcess);
- QVERIFY(initProcess->children[0]);
- QVERIFY(initProcess->children[1]);
- qCDebug(LIBKSYSGUARD) << initProcess->numChildren;
- initProcess->children[0]->parent = initProcess->children[1];
- initProcess->children[1]->children.append(initProcess->children[0]);
- initProcess->children[1]->numChildren++;
- initProcess->numChildren--;
- initProcess->children.removeAt(0);
+ QVERIFY(initProcess->children()[0]);
+ QVERIFY(initProcess->children()[1]);
+ qCDebug(LIBKSYSGUARD) << initProcess->numChildren();
+ initProcess->children()[0]->setParent(initProcess->children()[1]);
+ initProcess->children()[1]->children().append(initProcess->children()[0]);
+ initProcess->children()[1]->numChildren()++;
+ initProcess->numChildren()--;
+ initProcess->children().removeAt(0);
delete processController;
}
@@ -160,23 +160,23 @@
QList<KSysGuard::Process *> processes = processController->getAllProcesses();
Q_FOREACH( KSysGuard::Process *process, processes) {
- QCOMPARE(countNumChildren(process), process->numChildren);
+ QCOMPARE(countNumChildren(process), process->numChildren());
- for(int i =0; i < process->children.size(); i++) {
- QVERIFY(process->children[i]->parent);
- QCOMPARE(process->children[i]->parent, process);
+ for(int i =0; i < process->children().size(); i++) {
+ QVERIFY(process->children()[i]->parent());
+ QCOMPARE(process->children()[i]->parent(), process);
}
}
//test all the pids are unique
QSet<long> pids;
Q_FOREACH( KSysGuard::Process *process, processes) {
- if(process->pid == 0) continue;
- QVERIFY(process->pid > 0);
- QVERIFY(!process->name.isEmpty());
+ if(process->pid() == 0) continue;
+ QVERIFY(process->pid() > 0);
+ QVERIFY(!process->name().isEmpty());
- QVERIFY(!pids.contains(process->pid));
- pids.insert(process->pid);
+ QVERIFY(!pids.contains(process->pid()));
+ pids.insert(process->pid());
}
delete processController;
}
@@ -189,7 +189,7 @@
process = processController->getProcess(0);
process = processController->getProcess(1);
if (process)
- QCOMPARE(process->pid, 1l);
+ QCOMPARE(process->pid(), 1l);
// Make sure that this doesn't crash at least
processController->updateOrAddProcess(1);
|
[-]
[+]
|
Changed |
libksysguard.yaml
^
|
@@ -1,5 +1,5 @@
Name : libksysguard
-Version : 5.2.0
+Version : 5.3.0
Release : 1
Group : System/Base
License : GPLv2+
|