FreeBSD Bugzilla – Attachment 194586 Details for
Bug 229296
[NEW PORT] sysutils/libsysstat
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
add sysutils/libsysstat
libsysstat.diff (text/plain), 29.22 KB, created by
Jesper Schmitz Mouridsen
on 2018-06-24 20:43:33 UTC
(
hide
)
Description:
add sysutils/libsysstat
Filename:
MIME Type:
Creator:
Jesper Schmitz Mouridsen
Created:
2018-06-24 20:43:33 UTC
Size:
29.22 KB
patch
obsolete
>Index: sysutils/libsysstat/Makefile >=================================================================== >--- sysutils/libsysstat/Makefile (nonexistent) >+++ sysutils/libsysstat/Makefile (working copy) >@@ -0,0 +1,21 @@ >+# Created by: Olivier Duchateau >+# $FreeBSD$ >+ >+PORTNAME= libsysstat >+PORTVERSION= 0.4.0 >+CATEGORIES= sysutils >+MASTER_SITES= LXQT/${PORTNAME} >+ >+MAINTAINER= jesper@schmitz.computer >+COMMENT= Library used to query system info and statistics >+ >+LICENSE= LGPL21 >+ >+USES= cmake:outsource lxqt pkgconfig tar:xz >+USE_QT5= qmake_build buildtools_build core >+USE_LXQT= buildtools >+ >+post-extract: >+ @${CP} ${FILESDIR}/config.h.in ${WRKSRC}; >+ >+.include <bsd.port.mk> > >Property changes on: sysutils/libsysstat/Makefile >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:keywords >## -0,0 +1 ## >+FreeBSD=%H >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/distinfo >=================================================================== >--- sysutils/libsysstat/distinfo (nonexistent) >+++ sysutils/libsysstat/distinfo (working copy) >@@ -0,0 +1,3 @@ >+TIMESTAMP = 1509028217 >+SHA256 (lxqt/libsysstat-0.4.0.tar.xz) = 8fea723545aeb266f1a998d450aa4c985194b8b79d314817c7c2a78e9b4e996b >+SIZE (lxqt/libsysstat-0.4.0.tar.xz) = 17716 > >Property changes on: sysutils/libsysstat/distinfo >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/config.h.in >=================================================================== >--- sysutils/libsysstat/files/config.h.in (nonexistent) >+++ sysutils/libsysstat/files/config.h.in (working copy) >@@ -0,0 +1,3 @@ >+#cmakedefine HAVE_SYSCTL_H >+#cmakedefine HAVE_IF_H >+#cmakedefine HAVE_KVM_H > >Property changes on: sysutils/libsysstat/files/config.h.in >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/patch-CMakeLists.txt >=================================================================== >--- sysutils/libsysstat/files/patch-CMakeLists.txt (nonexistent) >+++ sysutils/libsysstat/files/patch-CMakeLists.txt (working copy) >@@ -0,0 +1,32 @@ >+--- CMakeLists.txt.orig 2016-12-10 23:50:29 UTC >++++ CMakeLists.txt >+@@ -23,6 +23,16 @@ include(LXQtCreatePkgConfigFile) >+ include(LXQtCreatePortableHeaders) >+ include(LXQtCompilerSettings NO_POLICY_SCOPE) >+ >++include(CheckIncludeFiles) >++include(CheckLibraryExists) >++ >++check_include_files("sys/socket.h;net/if.h;net/if_mib.h;net/if_types.h" HAVE_IF_H) >++check_library_exists(kvm kvm_getswapinfo "kvm.h" HAVE_KVM_H) >++check_library_exists(c sysctlbyname "sys/sysctl.h" HAVE_SYSCTL_H) >++ >++configure_file(config.h.in config.h) >++add_definitions("-DHAVE_CONFIG_H=1") >++ >+ set(CMAKE_AUTOMOC ON) >+ set(CMAKE_INCLUDE_CURRENT_DIR ON) >+ >+@@ -80,7 +90,11 @@ add_library(${SYSSTAT_LIBRARY_NAME} >+ ${SYSSTAT_QM_FILES} >+ ) >+ >+-target_link_libraries(${SYSSTAT_LIBRARY_NAME} Qt5::Core) >++if(HAVE_SYSCTL_H AND HAVE_KVM_H) >++ target_link_libraries(${SYSSTAT_LIBRARY_NAME} c kvm Qt5::Core) >++else() >++ target_link_libraries(${SYSSTAT_LIBRARY_NAME} Qt5::Core) >++endif() >+ >+ set_target_properties(${SYSSTAT_LIBRARY_NAME} PROPERTIES >+ VERSION ${SYSSTAT_VERSION} > >Property changes on: sysutils/libsysstat/files/patch-CMakeLists.txt >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/patch-cpustat.cpp >=================================================================== >--- sysutils/libsysstat/files/patch-cpustat.cpp (nonexistent) >+++ sysutils/libsysstat/files/patch-cpustat.cpp (working copy) >@@ -0,0 +1,294 @@ >+--- cpustat.cpp.orig 2017-09-23 12:46:10 UTC >++++ cpustat.cpp >+@@ -23,15 +23,68 @@ >+ ** >+ ** END_COMMON_COPYRIGHT_HEADER */ >+ >+- >++#ifdef HAVE_CONFIG_H >++#include "config.h" >++#endif >+ #include <unistd.h> >++#ifdef HAVE_SYSCTL_H >++extern "C" >++{ >++ #include <stdlib.h> >++ #include <limits.h> >++ #include <string.h> >++ #include <sys/resource.h> /* CPUSTATES */ >+ >++ #include <sys/types.h> >++ #include <sys/sysctl.h> >++} >++#endif >+ #include "cpustat.h" >+ #include "cpustat_p.h" >+ >+ >+ namespace SysStat { >+ >++#ifdef HAVE_SYSCTL_H >++char *GetFirstFragment(char *string, const char *delim) >++{ >++ char *token = NULL; >++ >++ token = strsep(&string, delim); >++ if (token != NULL) >++ { >++ /* We need only the first fragment, so no loop! */ >++ return token; >++ } >++ else >++ return NULL; >++} >++ >++int GetCpu(void) >++{ >++ static int mib[] = { CTL_HW, HW_NCPU }; >++ int buf; >++ size_t len = sizeof(int); >++ >++ if (sysctl(mib, 2, &buf, &len, NULL, 0) < 0) >++ return 0; >++ else >++ return buf; >++} >++ >++/* Frequence is in MHz */ >++ulong CurrentFreq(void) >++{ >++ ulong freq; >++ size_t len = sizeof(freq); >++ >++ if (sysctlbyname("dev.cpu.0.freq", &freq, &len, NULL, 0) < 0) >++ return 0; >++ else >++ return freq; >++} >++#endif >++ >+ CpuStatPrivate::CpuStatPrivate(CpuStat *parent) >+ : BaseStatPrivate(parent) >+ , mMonitoring(CpuStat::LoadAndFrequency) >+@@ -39,7 +92,10 @@ CpuStatPrivate::CpuStatPrivate(CpuStat * >+ mSource = defaultSource(); >+ >+ connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); >+- >++#ifdef HAVE_SYSCTL_H >++ size_t flen=2; >++ sysctlnametomib("kern.cp_times",mib,&flen); >++#endif >+ mUserHz = sysconf(_SC_CLK_TCK); >+ >+ updateSources(); >+@@ -47,6 +103,49 @@ CpuStatPrivate::CpuStatPrivate(CpuStat * >+ >+ void CpuStatPrivate::addSource(const QString &source) >+ { >++#ifdef HAVE_SYSCTL_H >++ char buf[1024]; >++ char *tokens, *t; >++ ulong min = 0, max = 0; >++ size_t len = sizeof(buf); >++ >++ /* The string returned by the dev.cpu.0.freq_levels sysctl >++ * is a space separated list of MHz/milliwatts. >++ */ >++ if (sysctlbyname("dev.cpu.0.freq_levels", buf, &len, NULL, 0) < 0) >++ return; >++ >++ t = strndup(buf, len); >++ if (t == NULL) >++ { >++ free(t); >++ return; >++ } >++ >++ while ((tokens = strsep(&t, " ")) != NULL) >++ { >++ char *freq; >++ ulong res; >++ >++ freq = GetFirstFragment(tokens, "/"); >++ if (freq != NULL) >++ { >++ res = strtoul(freq, &freq, 10); >++ if (res > max) >++ { >++ max = res; >++ } >++ else >++ { >++ if ((min == 0) || (res < min)) >++ min = res; >++ } >++ } >++ } >++ >++ free(t); >++ mBounds[source] = qMakePair(min, max); >++#else >+ bool ok; >+ >+ uint min = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_min_freq").arg(source))).toUInt(&ok); >+@@ -56,11 +155,26 @@ void CpuStatPrivate::addSource(const QSt >+ if (ok) >+ mBounds[source] = qMakePair(min, max); >+ } >++#endif >+ } >+ >+ void CpuStatPrivate::updateSources() >+ { >+ mSources.clear(); >++#ifdef HAVE_SYSCTL_H >++ int cpu; >++ >++ cpu = GetCpu(); >++ for (int i =0;i<cpu;i++) >++ { >++ mSources.append(QString("cpu%1").arg(i)); >++ >++ >++ >++ addSource(QString("cpu%1").arg(i)); >++ } >++ mBounds.clear(); >++#else >+ >+ foreach (const QString &row, readAllFile("/proc/stat").split(QChar('\n'), QString::SkipEmptyParts)) >+ { >+@@ -97,6 +211,7 @@ void CpuStatPrivate::updateSources() >+ addSource(QString("cpu%1").arg(number)); >+ } >+ } >++#endif >+ } >+ >+ CpuStatPrivate::~CpuStatPrivate() >+@@ -117,14 +232,98 @@ void CpuStatPrivate::recalculateMinMax() >+ { >+ int cores = 1; >+ if (mSource == "cpu") >++#ifdef HAVE_SYSCTL_H >++ cores = mSources.size(); >++#else >+ cores = mSources.size() - 1; >+- >++#endif >+ mIntervalMin = static_cast<float>(mTimer->interval()) / 1000 * static_cast<float>(mUserHz) * static_cast<float>(cores) / 1.25; // -25% >+ mIntervalMax = static_cast<float>(mTimer->interval()) / 1000 * static_cast<float>(mUserHz) * static_cast<float>(cores) * 1.25; // +25% >+ } >+ >+ void CpuStatPrivate::timeout() >+ { >++#ifdef HAVE_SYSCTL_H >++ if ( (mMonitoring == CpuStat::LoadOnly) >++ || (mMonitoring == CpuStat::LoadAndFrequency) ) >++ { >++ size_t cp_size = sizeof(long) * CPUSTATES * GetCpu(); >++ long *cp_times = (long *)malloc(cp_size); >++ Values current; >++ int cpuNumber = mSource.midRef(3).toInt(); >++ if (sysctl(mib,2, cp_times, &cp_size, NULL, 0) < 0) >++ free(cp_times); >++ >++ current.user = static_cast<ulong>(cp_times[CP_USER+cpuNumber*CPUSTATES]); >++ current.nice = static_cast<ulong>(cp_times[CP_NICE+cpuNumber*CPUSTATES]); >++ current.system = static_cast<ulong>(cp_times[CP_SYS+cpuNumber*CPUSTATES]); >++ current.idle = static_cast<ulong>(cp_times[CP_IDLE+cpuNumber*CPUSTATES]); >++ current.other = static_cast<ulong>(cp_times[CP_INTR+cpuNumber*CPUSTATES]); >++ current.total = current.user + current.nice + current.system+current.idle+current.other; >++ >++ float sumDelta = static_cast<float>(current.total - mPrevious.total); >++ >++ if ((mPrevious.total != 0) && ((sumDelta < mIntervalMin) || (sumDelta > mIntervalMax))) >++ { >++ if (mMonitoring == CpuStat::LoadAndFrequency) >++ emit update(0.0, 0.0, 0.0, 0.0, 0.0, 0); >++ else >++ emit update(0.0, 0.0, 0.0, 0.0, 0.0); >++ >++ mPrevious.clear(); >++ } >++ else >++ { >++ if (mMonitoring == CpuStat::LoadAndFrequency) >++ { >++ ulong freq = 0; >++ >++ freq = CurrentFreq(); >++ if (freq > 0) >++ { >++ emit update( >++ static_cast<float>(current.user - mPrevious.user ) / sumDelta, >++ static_cast<float>(current.nice - mPrevious.nice ) / sumDelta, >++ static_cast<float>(current.system - mPrevious.system ) / sumDelta, >++ static_cast<float>(current.idle - mPrevious.idle ) / sumDelta, >++ static_cast<float>(current.other - mPrevious.other ) / sumDelta, >++ freq); >++ } >++ else >++ { >++ emit update( >++ static_cast<float>(current.user - mPrevious.user ) / sumDelta, >++ static_cast<float>(current.nice - mPrevious.nice ) / sumDelta, >++ static_cast<float>(current.system - mPrevious.system ) / sumDelta, >++ static_cast<float>(current.idle - mPrevious.idle ) / sumDelta, >++ static_cast<float>(current.other - mPrevious.other ) / sumDelta); >++ } >++ } >++ else >++ { >++ >++ emit update( >++ static_cast<float>(current.user - mPrevious.user ) / sumDelta, >++ static_cast<float>(current.nice - mPrevious.nice ) / sumDelta, >++ static_cast<float>(current.system - mPrevious.system ) / sumDelta, >++ static_cast<float>(current.idle - mPrevious.idle ) / sumDelta, >++ static_cast<float>(current.other - mPrevious.other ) / sumDelta); >++ } >++ >++ mPrevious = current; >++ } >++ >++ free(cp_times); >++ } >++ else >++ { >++ ulong freq = 0; >++ >++ freq = CurrentFreq(); >++ if (freq > 0) >++ emit update(freq); >++ } >++#else >+ if ( (mMonitoring == CpuStat::LoadOnly) >+ || (mMonitoring == CpuStat::LoadAndFrequency) ) >+ { >+@@ -258,6 +457,7 @@ void CpuStatPrivate::timeout() >+ } >+ emit update(freq); >+ } >++#endif >+ } >+ >+ QString CpuStatPrivate::defaultSource() >+@@ -301,10 +501,15 @@ CpuStat::CpuStat(QObject *parent) >+ { >+ impl = new CpuStatPrivate(this); >+ baseimpl = impl; >+- >++#ifdef HAVE_SYSCTL_H >++ connect(impl, SIGNAL(update(float,float,float,float,float,ulong)), this, SIGNAL(update(float,float,float,float,float,ulong))); >++ connect(impl, SIGNAL(update(float,float,float,float,float)), this, SIGNAL(update(float,float,float,float,float))); >++ connect(impl, SIGNAL(update(ulong)), this, SIGNAL(update(ulong))); >++#else >+ connect(impl, SIGNAL(update(float,float,float,float,float,uint)), this, SIGNAL(update(float,float,float,float,float,uint))); >+ connect(impl, SIGNAL(update(float,float,float,float)), this, SIGNAL(update(float,float,float,float))); >+ connect(impl, SIGNAL(update(uint)), this, SIGNAL(update(uint))); >++#endif >+ } >+ >+ CpuStat::~CpuStat() > >Property changes on: sysutils/libsysstat/files/patch-cpustat.cpp >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/patch-cpustat.h >=================================================================== >--- sysutils/libsysstat/files/patch-cpustat.h (nonexistent) >+++ sysutils/libsysstat/files/patch-cpustat.h (working copy) >@@ -0,0 +1,52 @@ >+--- cpustat.h.orig 2016-12-10 23:50:29 UTC >++++ cpustat.h >+@@ -27,6 +27,11 @@ >+ #ifndef LIBSYSSTAT__CPU_STAT__INCLUDED >+ #define LIBSYSSTAT__CPU_STAT__INCLUDED >+ >++#ifdef HAVE_CONFIG_H >++#include "config.h" >++#endif >++ >++#include <cstdio> >+ >+ #include <QtCore/QObject> >+ >+@@ -35,6 +40,12 @@ >+ >+ namespace SysStat { >+ >++#ifdef HAVE_SYSCTL_H >++ char *GetFirstFragment(char *string, const char *delim); >++ int GetCpu(void); >++ ulong CurrentFreq(void); >++#endif >++ >+ class CpuStatPrivate; >+ >+ class SYSSTATSHARED_EXPORT CpuStat : public BaseStat >+@@ -52,13 +63,23 @@ public: >+ >+ void updateSources(); >+ >++#ifdef HAVE_SYSCTL_H >+ uint minFreq(const QString &source) const; >+ uint maxFreq(const QString &source) const; >+ >+ signals: >+- void update(float user, float nice, float system, float other, float frequencyRate, uint frequency); >++ void update(float user, float nice, float system, float idle, float other, ulong frequency); >++ void update(float user, float nice, float system, float idle, float other); >++ void update(ulong frequency); >++#else >++ ulong minFreq(const QString &source) const; >++ ulong maxFreq(const QString &source) const; >++ >++signals: >++ void update(float user, float nice, float system, float frequencyRate, uint frequency); >+ void update(float user, float nice, float system, float other); >+ void update(uint frequency); >++#endif >+ >+ void monitoringChanged(Monitoring); >+ > >Property changes on: sysutils/libsysstat/files/patch-cpustat.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/patch-cpustat__p.h >=================================================================== >--- sysutils/libsysstat/files/patch-cpustat__p.h (nonexistent) >+++ sysutils/libsysstat/files/patch-cpustat__p.h (working copy) >@@ -0,0 +1,73 @@ >+--- cpustat_p.h.orig 2016-12-10 23:50:29 UTC >++++ cpustat_p.h >+@@ -27,6 +27,9 @@ >+ #ifndef LIBSYSSTAT__CPU_STAT__PRIVATE__INCLUDED >+ #define LIBSYSSTAT__CPU_STAT__PRIVATE__INCLUDED >+ >++#ifdef HAVE_CONFIG_H >++#include "config.h" >++#endif >+ >+ #include <QtCore/QObject> >+ #include <QtCore/QtGlobal> >+@@ -52,6 +55,15 @@ public: >+ CpuStat::Monitoring monitoring() const; >+ void setMonitoring(CpuStat::Monitoring value); >+ >++#ifdef HAVE_SYSCTL_H >++ ulong minFreq(const QString &source) const; >++ ulong maxFreq(const QString &source) const; >++ >++signals: >++ void update(float user, float nice, float system, float idle, float other); >++ void update(ulong frequency); >++ void update(float user, float nice, float system, float idle, float other, ulong frequency); >++#else >+ uint minFreq(const QString &source) const; >+ uint maxFreq(const QString &source) const; >+ >+@@ -59,6 +71,7 @@ signals: >+ void update(float user, float nice, float system, float other); >+ void update(uint frequency); >+ void update(float user, float nice, float system, float other, float frequencyRate, uint frequency); >++#endif >+ >+ private slots: >+ void timeout(); >+@@ -74,22 +87,35 @@ private: >+ { >+ Values(); >+ >++#ifdef HAVE_SYSCTL_H >++ ulong user; >++ ulong nice; >++ ulong system; >++ ulong idle; >++ ulong other; >++ ulong total; >++#else >+ qulonglong user; >+ qulonglong nice; >+ qulonglong system; >+ qulonglong idle; >+ qulonglong other; >+ qulonglong total; >++#endif >+ >+ void sum(); >+ >+ void clear(); >+ } Values; >+ Values mPrevious; >+- >++ int mib[2]; >+ CpuStat::Monitoring mMonitoring; >+ >++#ifdef HAVE_SYSCTL_H >++ typedef QMap<QString, QPair<ulong, ulong> > Bounds; >++#else >+ typedef QMap<QString, QPair<uint, uint> > Bounds; >++#endif >+ Bounds mBounds; >+ >+ int mUserHz; > >Property changes on: sysutils/libsysstat/files/patch-cpustat__p.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/patch-memstat.cpp >=================================================================== >--- sysutils/libsysstat/files/patch-memstat.cpp (nonexistent) >+++ sysutils/libsysstat/files/patch-memstat.cpp (working copy) >@@ -0,0 +1,134 @@ >+--- memstat.cpp.orig 2016-12-10 23:50:29 UTC >++++ memstat.cpp >+@@ -23,6 +23,24 @@ >+ ** >+ ** END_COMMON_COPYRIGHT_HEADER */ >+ >++#ifdef HAVE_CONFIG_H >++#include "config.h" >++#endif >++ >++#include <cstdio> >++ >++#if defined(HAVE_KVM_H) && defined(HAVE_SYSCTL_H) >++extern "C" >++{ >++ #include <paths.h> >++ #include <unistd.h> >++ #include <fcntl.h> >++ >++ #include <kvm.h> >++ #include <sys/types.h> >++ #include <sys/sysctl.h> >++} >++#endif >+ >+ #include "memstat.h" >+ #include "memstat_p.h" >+@@ -30,6 +48,45 @@ >+ >+ namespace SysStat { >+ >++#ifdef HAVE_SYSCTL_H >++int SwapDevices() >++{ >++ int buf; >++ size_t len = sizeof(int); >++ >++ if (sysctlbyname("vm.nswapdev", &buf, &len, NULL, 0) < 0) >++ return 0; >++ else >++ return buf; >++} >++ >++qulonglong MemGetByBytes(QString property) >++{ >++ qulonglong buf=0; >++ size_t len = sizeof(qulonglong); >++ >++ std::string s = property.toStdString(); >++ const char *name = s.c_str(); >++ >++ if (sysctlbyname(name, &buf, &len, NULL, 0) < 0) >++ return 0; >++ else >++ return buf; >++} >++ >++qulonglong MemGetByPages(QString name) >++{ >++ qulonglong res = 0; >++ >++ >++ res = MemGetByBytes(name); >++ if (res > 0) >++ res = res * getpagesize(); >++ >++ return res; >++} >++#endif >++ >+ MemStatPrivate::MemStatPrivate(MemStat *parent) >+ : BaseStatPrivate(parent) >+ { >+@@ -51,6 +108,40 @@ void MemStatPrivate::timeout() >+ qulonglong memBuffers = 0; >+ qulonglong memCached = 0; >+ qulonglong swapTotal = 0; >++ >++#ifdef HAVE_SYSCTL_H >++ memTotal = MemGetByBytes("hw.physmem"); >++ memFree = MemGetByPages("vm.stats.vm.v_free_count"); >++ memBuffers = MemGetByBytes("vfs.bufspace"); >++ memCached = MemGetByPages("vm.stats.vm.v_inactive_count"); >++#endif >++ >++#ifdef HAVE_KVM_H >++ qulonglong swapUsed = 0; >++ kvm_t *kd; >++ struct kvm_swap kswap[16]; /* size taken from pstat/pstat.c */ >++ >++ kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open"); >++ if (kd == NULL) >++ kvm_close(kd); >++ >++ if (kvm_getswapinfo(kd, kswap, (sizeof(kswap) / sizeof(kswap[0])), SWIF_DEV_PREFIX) > 0) >++ { >++ int swapd = SwapDevices(); >++ /* TODO: loop over swap devives */ >++ if (swapd >= 1) >++ { >++ swapTotal = static_cast<qulonglong>(kswap[0].ksw_total * getpagesize()); >++ swapUsed = static_cast<qulonglong>(kswap[0].ksw_used * getpagesize()); >++ } >++ >++ kvm_close(kd); >++ } >++ else >++ kvm_close(kd); >++#endif >++ >++#ifndef HAVE_SYSCTL_H >+ qulonglong swapFree = 0; >+ >+ foreach (QString row, readAllFile("/proc/meminfo").split(QChar('\n'), QString::SkipEmptyParts)) >+@@ -72,6 +163,7 @@ void MemStatPrivate::timeout() >+ else if(tokens[0] == "SwapFree:") >+ swapFree = tokens[1].toULong(); >+ } >++#endif >+ >+ if (mSource == "memory") >+ { >+@@ -89,7 +181,11 @@ void MemStatPrivate::timeout() >+ { >+ if (swapTotal) >+ { >++#ifndef HAVE_KVM_H >+ float swapUsed_d = static_cast<float>(swapTotal - swapFree) / static_cast<float>(swapTotal); >++#else >++ float swapUsed_d = static_cast<float>(swapUsed) / static_cast<float>(swapTotal); >++#endif >+ >+ emit swapUpdate(swapUsed_d); >+ } > >Property changes on: sysutils/libsysstat/files/patch-memstat.cpp >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/patch-memstat.h >=================================================================== >--- sysutils/libsysstat/files/patch-memstat.h (nonexistent) >+++ sysutils/libsysstat/files/patch-memstat.h (working copy) >@@ -0,0 +1,25 @@ >+--- memstat.h.orig 2016-12-10 23:50:29 UTC >++++ memstat.h >+@@ -27,6 +27,9 @@ >+ #ifndef LIBSYSSTAT__MEM_STAT__INCLUDED >+ #define LIBSYSSTAT__MEM_STAT__INCLUDED >+ >++#ifdef HAVE_CONFIG_H >++#include "config.h" >++#endif >+ >+ #include <QtCore/QObject> >+ >+@@ -35,6 +38,12 @@ >+ >+ namespace SysStat { >+ >++#if defined(HAVE_SYSCTL_H) && defined(HAVE_KVM_H) >++ int SwapDevices(); >++ qulonglong MemGetByBytes(const QString property); >++ qulonglong MemGetByPages(const QString property); >++#endif >++ >+ class MemStatPrivate; >+ >+ class SYSSTATSHARED_EXPORT MemStat : public BaseStat > >Property changes on: sysutils/libsysstat/files/patch-memstat.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/files/patch-netstat.cpp >=================================================================== >--- sysutils/libsysstat/files/patch-netstat.cpp (nonexistent) >+++ sysutils/libsysstat/files/patch-netstat.cpp (working copy) >@@ -0,0 +1,125 @@ >+--- netstat.cpp.orig 2016-12-10 23:50:29 UTC >++++ netstat.cpp >+@@ -23,6 +23,23 @@ >+ ** >+ ** END_COMMON_COPYRIGHT_HEADER */ >+ >++#ifdef HAVE_CONFIG_H >++#include "config.h" >++#endif >++ >++#include <cstdio> >++ >++#if defined(HAVE_SYSCTL_H) && defined(HAVE_IF_H) >++extern "C" >++{ >++ #include <net/if.h> >++ #include <net/if_mib.h> >++ #include <net/if_types.h> >++ #include <sys/socket.h> /* PF_LINK */ >++ #include <sys/types.h> >++ #include <sys/sysctl.h> >++} >++#endif >+ >+ #include "netstat.h" >+ #include "netstat_p.h" >+@@ -37,7 +54,7 @@ NetStatPrivate::NetStatPrivate(NetStat * >+ >+ connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); >+ >+- >++#ifndef HAVE_SYSCTL_H >+ QStringList rows(readAllFile("/proc/net/dev").split(QChar('\n'), QString::SkipEmptyParts)); >+ >+ rows.erase(rows.begin(), rows.begin() + 2); >+@@ -50,6 +67,30 @@ NetStatPrivate::NetStatPrivate(NetStat * >+ >+ mSources.append(tokens[0].trimmed()); >+ } >++#else >++ int count; >++ size_t len; >++ int cntifmib[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT };// net.link.generic.system.ifcount; >++ len = sizeof(int); >++ if (sysctl(cntifmib, 5, &count, &len, NULL, 0) < 0) >++ perror("sysctl"); >++ >++ >++ struct ifmibdata ifmd; >++ size_t len1 = sizeof(ifmd); >++ for (int i=1; i<=count;i++) { >++ int name[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, i, IFDATA_GENERAL }; >++ >++ if (sysctl(name, 6, &ifmd, &len1, NULL, 0) < 0) { >++ perror("sysctl"); >++ } >++ if ((ifmd.ifmd_data.ifi_type == IFT_ETHER) || (ifmd.ifmd_data.ifi_type == IFT_IEEE80211)) { >++ const char *iface = ifmd.ifmd_name; >++ mSources.append(QString::fromLatin1(iface)); >++ } >++ } >++ >++#endif >+ } >+ >+ NetStatPrivate::~NetStatPrivate() >+@@ -58,6 +99,50 @@ NetStatPrivate::~NetStatPrivate() >+ >+ void NetStatPrivate::timeout() >+ { >++#if defined(HAVE_IF_H) && defined(HAVE_SYSCTL_H) >++ int count; >++ size_t len; >++ int name[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT }; >++ struct ifmibdata ifmd; >++ >++ len = sizeof(int); >++ if (sysctl(name, 5, &count, &len, NULL, 0) < 0) >++ return; >++ >++ for (int i = 1; i <= count; i++) >++ { >++ len = sizeof(ifmd); >++ int name[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, i, IFDATA_GENERAL }; >++ >++ if (sysctl(name, 6, &ifmd, &len, NULL, 0) < 0) >++ break; >++ >++ if ((ifmd.ifmd_data.ifi_type == IFT_ETHER) || (ifmd.ifmd_data.ifi_type == IFT_IEEE80211)) >++ { >++ const char *iface = ifmd.ifmd_name; >++ QString interfaceName = QString::fromLatin1(iface); >++ if ((ifmd.ifmd_data.ifi_link_state == LINK_STATE_UP) && (ifmd.ifmd_data.ifi_ipackets > 0)) >++ { >++ >++ >++ Values current; >++ current.received = ifmd.ifmd_data.ifi_ibytes; >++ current.transmitted = ifmd.ifmd_data.ifi_obytes; >++ >++ if (!mPrevious.contains(interfaceName)) >++ mPrevious.insert(interfaceName, Values()); >++ const Values &previous = mPrevious[interfaceName]; >++ >++ if (interfaceName == mSource) >++ emit update((( current.received - previous.received ) * 1000 ) / mTimer->interval(), (( current.transmitted - previous.transmitted ) * 1000 ) / mTimer->interval()); >++ >++ mPrevious[interfaceName] = current; >++ } else if(interfaceName == mSource) >++ emit(update(0,0)); >++ >++ } >++ } >++#else >+ QStringList rows(readAllFile("/proc/net/dev").split(QChar('\n'), QString::SkipEmptyParts)); >+ >+ >+@@ -99,6 +184,7 @@ void NetStatPrivate::timeout() >+ >+ mPrevious[interfaceName] = current; >+ } >++#endif >+ } >+ >+ QString NetStatPrivate::defaultSource() > >Property changes on: sysutils/libsysstat/files/patch-netstat.cpp >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/pkg-descr >=================================================================== >--- sysutils/libsysstat/pkg-descr (nonexistent) >+++ sysutils/libsysstat/pkg-descr (working copy) >@@ -0,0 +1,4 @@ >+Qt-based library to query system information like CPU, memory usage and >+network traffic. >+ >+WWW: http://lxqt.org/ > >Property changes on: sysutils/libsysstat/pkg-descr >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/libsysstat/pkg-plist >=================================================================== >--- sysutils/libsysstat/pkg-plist (nonexistent) >+++ sysutils/libsysstat/pkg-plist (working copy) >@@ -0,0 +1,20 @@ >+include/sysstat-qt5/SysStat/BaseStat >+include/sysstat-qt5/SysStat/CpuStat >+include/sysstat-qt5/SysStat/Global >+include/sysstat-qt5/SysStat/MemStat >+include/sysstat-qt5/SysStat/NetStat >+include/sysstat-qt5/SysStat/Version >+include/sysstat-qt5/basestat.h >+include/sysstat-qt5/cpustat.h >+include/sysstat-qt5/memstat.h >+include/sysstat-qt5/netstat.h >+include/sysstat-qt5/sysstat_global.h >+include/sysstat-qt5/version.h >+lib/libsysstat-qt5.so >+lib/libsysstat-qt5.so.0 >+lib/libsysstat-qt5.so.%%VERSION%% >+libdata/pkgconfig/sysstat-qt5.pc >+share/cmake/sysstat-qt5/sysstat-qt5-config-version.cmake >+share/cmake/sysstat-qt5/sysstat-qt5-config.cmake >+share/cmake/sysstat-qt5/sysstat-qt5-targets-%%CMAKE_BUILD_TYPE%%.cmake >+share/cmake/sysstat-qt5/sysstat-qt5-targets.cmake > >Property changes on: sysutils/libsysstat/pkg-plist >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229296
:
194586
|
194771