From owner-dev-commits-ports-main@freebsd.org Sat May 8 16:58:57 2021 Return-Path: Delivered-To: dev-commits-ports-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D12006399CB; Sat, 8 May 2021 16:58:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FctnY3mx5z3JVc; Sat, 8 May 2021 16:58:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7425422412; Sat, 8 May 2021 16:58:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 148Gwvnl060023; Sat, 8 May 2021 16:58:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 148GwvIu060022; Sat, 8 May 2021 16:58:57 GMT (envelope-from git) Date: Sat, 8 May 2021 16:58:57 GMT Message-Id: <202105081658.148GwvIu060022@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Jesper Schmitz Mouridsen Subject: git: 8d9632ac336b - main - sysutils/libsysstat: Update to 0.4.5 - Improve patches for per cpu freq levels. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jsm X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d9632ac336b47ca89064b79d575c05b37982c31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the main branch of the FreeBSD ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 16:58:57 -0000 The branch main has been updated by jsm: URL: https://cgit.FreeBSD.org/ports/commit/?id=8d9632ac336b47ca89064b79d575c05b37982c31 commit 8d9632ac336b47ca89064b79d575c05b37982c31 Author: Jesper Schmitz Mouridsen AuthorDate: 2021-05-08 15:41:56 +0000 Commit: Jesper Schmitz Mouridsen CommitDate: 2021-05-08 16:51:58 +0000 sysutils/libsysstat: Update to 0.4.5 - Improve patches for per cpu freq levels. --- sysutils/libsysstat/Makefile | 2 +- sysutils/libsysstat/distinfo | 6 +- sysutils/libsysstat/files/patch-cpustat.cpp | 148 +++++++++++++++------------ sysutils/libsysstat/files/patch-cpustat__p.h | 6 +- sysutils/libsysstat/files/patch-memstat.cpp | 14 +-- sysutils/libsysstat/files/patch-netstat.cpp | 23 ++--- 6 files changed, 109 insertions(+), 90 deletions(-) diff --git a/sysutils/libsysstat/Makefile b/sysutils/libsysstat/Makefile index d29e183d7935..3a4454f845ed 100644 --- a/sysutils/libsysstat/Makefile +++ b/sysutils/libsysstat/Makefile @@ -1,7 +1,7 @@ # Created by: Olivier Duchateau PORTNAME= libsysstat -PORTVERSION= 0.4.4 +PORTVERSION= 0.4.5 CATEGORIES= sysutils MASTER_SITES= LXQT/${PORTNAME} diff --git a/sysutils/libsysstat/distinfo b/sysutils/libsysstat/distinfo index b4518185c58a..8aaec17c51de 100644 --- a/sysutils/libsysstat/distinfo +++ b/sysutils/libsysstat/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1605119504 -SHA256 (lxqt/libsysstat-0.4.4.tar.xz) = 3997d17692d2ea467d384517aedb8fcc4050f2f66114a1405d42cef0adaafa6b -SIZE (lxqt/libsysstat-0.4.4.tar.xz) = 17532 +TIMESTAMP = 1618772764 +SHA256 (lxqt/libsysstat-0.4.5.tar.xz) = f19b6550d78939cc1ad11c5788e2a7293f7f886d037837cd1cf56ebcdf2b5ed2 +SIZE (lxqt/libsysstat-0.4.5.tar.xz) = 17744 diff --git a/sysutils/libsysstat/files/patch-cpustat.cpp b/sysutils/libsysstat/files/patch-cpustat.cpp index 59df2dc3b1dc..0ede73fd5524 100644 --- a/sysutils/libsysstat/files/patch-cpustat.cpp +++ b/sysutils/libsysstat/files/patch-cpustat.cpp @@ -1,8 +1,13 @@ ---- cpustat.cpp.orig 2020-11-03 14:45:02 UTC +--- cpustat.cpp.orig 2021-04-07 06:58:34 UTC +++ cpustat.cpp -@@ -27,11 +27,64 @@ +@@ -22,16 +22,65 @@ + ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + ** + ** END_COMMON_COPYRIGHT_HEADER */ +- +- #include - +- #include "cpustat.h" +#ifdef HAVE_SYSCTL_H +extern "C" @@ -48,24 +53,23 @@ +} + +/* Frequence is in MHz */ -+ulong CpuStatPrivate::CurrentFreq(void) ++ulong CpuStatPrivate::CurrentFreq(QString mSource) +{ + ulong freq=0; + size_t len = sizeof(freq); -+ -+ if (sysctl(mib2,4,&freq, &len, NULL, 0) < 0) { // man cpufreq BUGS section all cores have the same frequency. -+ perror("sysctl"); ++ int i = mSource.mid(3).toInt(); ++ if (sysctl(mib2[i],4,&freq, &len, NULL, 0) < 0) { ++ perror("sysctl"); + return 0; -+} ++ } + else + return freq; -+ +} +#endif CpuStatPrivate::CpuStatPrivate(CpuStat *parent) : BaseStatPrivate(parent) , mMonitoring(CpuStat::LoadAndFrequency) -@@ -39,7 +92,13 @@ CpuStatPrivate::CpuStatPrivate(CpuStat *parent) +@@ -39,7 +88,17 @@ CpuStatPrivate::CpuStatPrivate(CpuStat *parent) mSource = defaultSource(); connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); @@ -75,7 +79,11 @@ + size_t alen=4; + sysctlnametomib("kern.cp_times",mib0,&flen); + sysctlnametomib("kern.cp_time",mib1,&flen); -+ sysctlnametomib("dev.cpu.0.freq",mib2,&alen); ++ int ncpu = GetCpu(); ++ for (int i=0;i-1) { + ++ if (sysctlbyname(QString::fromLatin1("dev.cpu.%1.freq_levels").arg(source.midRef(3).toInt()).toStdString().c_str(), buf, &len, NULL, 0) < 0) ++ return; ++ } + t = strndup(buf, len); + if (t == NULL) + { @@ -120,19 +130,17 @@ + if ((min == 0) || (res < min)) + min = res; + } -+ if (res + 1 == max) -+ max--; -+ } ++ } + + } + + free(t); + mBounds[source] = qMakePair(min, max); -+ #else - bool ok; ++#else + bool ok = false; uint min = readAllFile(qPrintable(QString::fromLatin1("/sys/devices/system/cpu/%1/cpufreq/scaling_min_freq").arg(source))).toUInt(&ok); -@@ -56,12 +160,27 @@ void CpuStatPrivate::addSource(const QString &source) +@@ -56,11 +160,35 @@ void CpuStatPrivate::addSource(const QString &source) if (ok) mBounds[source] = qMakePair(min, max); } @@ -145,30 +153,38 @@ +#ifdef HAVE_SYSCTL_H + mBounds.clear(); + int cpu; - ++ + cpu = GetCpu(); -+ mSources.append(QStringLiteral("cpu")); // Linux has cpu in /proc/stat ++ mSources.append(QString::fromLatin1("cpu")); + for (int i =0;i= QT_VERSION_CHECK(5,15,0)) + const QStringList rows = readAllFile("/proc/stat").split(QLatin1Char('\n'), Qt::SkipEmptyParts); + #else +@@ -110,6 +238,7 @@ void CpuStatPrivate::updateSources() addSource(QString::fromLatin1("cpu%1").arg(number)); } } +#endif } - CpuStatPrivate::~CpuStatPrivate() -@@ -127,6 +247,107 @@ void CpuStatPrivate::recalculateMinMax() + CpuStatPrivate::~CpuStatPrivate() = default; +@@ -136,6 +265,113 @@ void CpuStatPrivate::recalculateMinMax() void CpuStatPrivate::timeout() { @@ -178,7 +194,9 @@ + { + int cpuNumber=0; + long *cp_times=0; -+ if(mSource!=QLatin1String("cpu")) { ++ ++ if(mSource!=QLatin1String("cpu")) ++ { + size_t cp_size = sizeof(long) * CPUSTATES * GetCpu(); + cp_times = (long *)malloc(cp_size); + cpuNumber = mSource.midRef(3).toInt(); @@ -188,7 +206,10 @@ + size_t cp_size = sizeof(long)*CPUSTATES; + cp_times = (long *)malloc(cp_size); + if(sysctl(mib1,2,cp_times,&cp_size,NULL,0) < 0) ++ { ++ perror("sysctl"); + free(cp_times); ++ } + } + Values current; + current.user = static_cast(cp_times[CP_USER+cpuNumber*CPUSTATES]); @@ -197,49 +218,51 @@ + current.idle = static_cast(cp_times[CP_IDLE+cpuNumber*CPUSTATES]); + current.other = static_cast(cp_times[CP_INTR+cpuNumber*CPUSTATES]); + current.total = current.user + current.nice + current.system+current.idle+current.other; -+ + float sumDelta = static_cast(current.total - mPrevious.total); + if ((mPrevious.total != 0) && ((sumDelta < mIntervalMin) || (sumDelta > mIntervalMax))) + { + if (mMonitoring == CpuStat::LoadAndFrequency) -+ { ++ { + float freqRate = 1.0; -+ ulong freq = CurrentFreq(); ++ ulong freq = CurrentFreq(mSource); + ++ if (mSource == QLatin1String("cpu")) { ++ freq=0; ++ for (Bounds::ConstIterator I = mBounds.constBegin(); I != mBounds.constEnd(); ++I) { ++ if (I.key() != QStringLiteral("cpu")) ++ { ++ freq += CurrentFreq(I.key()); ++ } ++ } ++ } ++ + if (freq > 0) + { -+ if (mSource == QLatin1String("cpu")) -+ mSource = QLatin1String("cpu0"); -+ //do not report more than 100% -+ if (freq > mBounds[mSource].second) { -+ freq = mBounds[mSource].second; -+ } + freqRate = static_cast(freq) / static_cast(mBounds[mSource].second); + emit update(0.0, 0.0, 0.0, 0.0, static_cast(freqRate), freq); -+ } -+ } -+ else { ++ } ++ } else { + emit update(0.0, 0.0, 0.0, 0.0); -+ } ++ } + mPrevious.clear(); -+ } -+ else -+ -+ { -+ if (mMonitoring == CpuStat::LoadAndFrequency) ++ } else { ++ if (mMonitoring == CpuStat::LoadAndFrequency) + { + float freqRate = 1.0; -+ ulong freq = CurrentFreq(); ++ ulong freq = CurrentFreq(mSource); + + if (freq > 0) + { -+ if (mSource == QLatin1String("cpu")) -+ mSource = QLatin1String("cpu0"); -+ //do not report more than 100% -+ if (freq > mBounds[mSource].second) { -+ freq = mBounds[mSource].second; -+ } -+ freqRate = static_cast(freq) / static_cast(mBounds[mSource].second); ++ if (mSource == QLatin1String("cpu")) { ++ freq=0; ++ for (Bounds::ConstIterator I = mBounds.constBegin(); I != mBounds.constEnd(); ++I) { ++ if (I.key() != QStringLiteral("cpu")) ++ { ++ freq += CurrentFreq(I.key()); ++ } ++ } ++ } ++ freqRate = static_cast(freq) / static_cast(mBounds[mSource].second); + emit update( + static_cast(current.user - mPrevious.user ) / sumDelta, + static_cast(current.nice - mPrevious.nice ) / sumDelta, @@ -247,8 +270,9 @@ + static_cast(current.other - mPrevious.other ) / sumDelta, + static_cast(freqRate), + freq); -+ } ++ + } ++ } + else + { + emit update( @@ -258,17 +282,15 @@ + static_cast(current.other - mPrevious.other ) / sumDelta); + } + -+ + mPrevious = current; + } -+ + free(cp_times); + } + else + { + ulong freq = 0; + -+ freq = CurrentFreq(); ++ freq = CurrentFreq(mSource); + if (freq > 0) + emit update(freq); + } @@ -276,7 +298,7 @@ if ( (mMonitoring == CpuStat::LoadOnly) || (mMonitoring == CpuStat::LoadAndFrequency) ) { -@@ -229,7 +450,7 @@ void CpuStatPrivate::timeout() +@@ -246,7 +482,7 @@ void CpuStatPrivate::timeout() mPrevious = current; } } @@ -285,7 +307,7 @@ } else { -@@ -261,6 +482,7 @@ void CpuStatPrivate::timeout() +@@ -278,6 +514,7 @@ void CpuStatPrivate::timeout() } emit update(freq); } diff --git a/sysutils/libsysstat/files/patch-cpustat__p.h b/sysutils/libsysstat/files/patch-cpustat__p.h index 168c6959f30f..3c56a8038991 100644 --- a/sysutils/libsysstat/files/patch-cpustat__p.h +++ b/sysutils/libsysstat/files/patch-cpustat__p.h @@ -1,4 +1,4 @@ ---- cpustat_p.h.orig 2020-11-03 14:45:02 UTC +--- cpustat_p.h.orig 2021-04-07 06:58:34 UTC +++ cpustat_p.h @@ -27,6 +27,9 @@ #ifndef LIBSYSSTAT__CPU_STAT__PRIVATE__INCLUDED @@ -17,7 +17,7 @@ +#ifdef HAVE_SYSCTL_H + ulong minFreq(const QString &source) const; + ulong maxFreq(const QString &source) const; -+ ulong CurrentFreq(void); ++ ulong CurrentFreq(const QString); + +#else uint minFreq(const QString &source) const; @@ -56,7 +56,7 @@ + typedef QMap > Bounds; + int mib0[2]; + int mib1[2]; -+ int mib2[4]; ++ int mib2[512][4]; +#else typedef QMap > Bounds; +#endif diff --git a/sysutils/libsysstat/files/patch-memstat.cpp b/sysutils/libsysstat/files/patch-memstat.cpp index 90fde0fa79d4..92134a8acf19 100644 --- a/sysutils/libsysstat/files/patch-memstat.cpp +++ b/sysutils/libsysstat/files/patch-memstat.cpp @@ -1,4 +1,4 @@ ---- memstat.cpp.orig 2019-01-24 21:43:32 UTC +--- memstat.cpp.orig 2021-04-18 21:03:41 UTC +++ memstat.cpp @@ -26,10 +26,58 @@ @@ -59,7 +59,7 @@ MemStatPrivate::MemStatPrivate(MemStat *parent) : BaseStatPrivate(parent) { -@@ -52,7 +100,37 @@ void MemStatPrivate::timeout() +@@ -50,7 +98,37 @@ void MemStatPrivate::timeout() qulonglong memCached = 0; qulonglong swapTotal = 0; qulonglong swapFree = 0; @@ -94,10 +94,10 @@ + kvm_close(kd); +#endif +#ifndef HAVE_SYSCTL_H - const QStringList rows = readAllFile("/proc/meminfo").split(QLatin1Char('\n'), QString::SkipEmptyParts); - for (const QString &row : rows) - { -@@ -73,7 +151,7 @@ void MemStatPrivate::timeout() + #if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + const QStringList rows = readAllFile("/proc/meminfo").split(QLatin1Char('\n'), Qt::SkipEmptyParts); + #else +@@ -79,7 +157,7 @@ void MemStatPrivate::timeout() else if(tokens[0] == QLatin1String("SwapFree:")) swapFree = tokens[1].toULong(); } @@ -106,7 +106,7 @@ if (mSource == QLatin1String("memory")) { if (memTotal) -@@ -90,8 +168,11 @@ void MemStatPrivate::timeout() +@@ -96,8 +174,11 @@ void MemStatPrivate::timeout() { if (swapTotal) { diff --git a/sysutils/libsysstat/files/patch-netstat.cpp b/sysutils/libsysstat/files/patch-netstat.cpp index c3a95336d6f9..f0f70a36fdd4 100644 --- a/sysutils/libsysstat/files/patch-netstat.cpp +++ b/sysutils/libsysstat/files/patch-netstat.cpp @@ -1,4 +1,4 @@ ---- netstat.cpp.orig 2019-01-30 19:24:29 UTC +--- netstat.cpp.orig 2021-04-18 21:04:00 UTC +++ netstat.cpp @@ -26,8 +26,23 @@ @@ -24,16 +24,15 @@ namespace SysStat { NetStatPrivate::NetStatPrivate(NetStat *parent) -@@ -37,7 +52,7 @@ NetStatPrivate::NetStatPrivate(NetStat *parent) +@@ -37,6 +52,7 @@ NetStatPrivate::NetStatPrivate(NetStat *parent) connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); -- +#ifndef HAVE_SYSCTL_H - QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), QString::SkipEmptyParts)); - rows.erase(rows.begin(), rows.begin() + 2); -@@ -50,6 +65,29 @@ NetStatPrivate::NetStatPrivate(NetStat *parent) + #if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), Qt::SkipEmptyParts)); +@@ -58,12 +74,78 @@ NetStatPrivate::NetStatPrivate(NetStat *parent) mSources.append(tokens[0].trimmed()); } @@ -62,8 +61,7 @@ +#endif } - NetStatPrivate::~NetStatPrivate() -@@ -58,6 +96,50 @@ NetStatPrivate::~NetStatPrivate() + NetStatPrivate::~NetStatPrivate() = default; void NetStatPrivate::timeout() { @@ -110,11 +108,10 @@ + + } + } -+#else - QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), QString::SkipEmptyParts)); - - -@@ -99,6 +181,7 @@ void NetStatPrivate::timeout() + #if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), Qt::SkipEmptyParts)); + #else +@@ -122,6 +204,7 @@ void NetStatPrivate::timeout() mPrevious[interfaceName] = current; }