chore: formatter
This commit is contained in:
@@ -45,8 +45,7 @@ void Memory::tick() {
|
|||||||
QStringLiteral("MemTotal: *(\\d+)"));
|
QStringLiteral("MemTotal: *(\\d+)"));
|
||||||
static const QRegularExpression reAvail(
|
static const QRegularExpression reAvail(
|
||||||
QStringLiteral("MemAvailable: *(\\d+)"));
|
QStringLiteral("MemAvailable: *(\\d+)"));
|
||||||
static const QRegularExpression reCached(QStringLiteral(
|
static const QRegularExpression reCached(QStringLiteral("Cached: *(\\d+)"));
|
||||||
"Cached: *(\\d+)"));
|
|
||||||
const QString text = QString::fromLatin1(data);
|
const QString text = QString::fromLatin1(data);
|
||||||
|
|
||||||
const auto totalMatch = reTotal.match(text);
|
const auto totalMatch = reTotal.match(text);
|
||||||
@@ -78,13 +77,13 @@ void Memory::tick() {
|
|||||||
const auto pgin = rePgin.match(vtext);
|
const auto pgin = rePgin.match(vtext);
|
||||||
const auto pgout = rePgout.match(vtext);
|
const auto pgout = rePgout.match(vtext);
|
||||||
if (pgin.hasMatch()) {
|
if (pgin.hasMatch()) {
|
||||||
readKib = static_cast<quint64>(static_cast<double>(
|
readKib = static_cast<quint64>(
|
||||||
pgin.captured(1).toULongLong()) *
|
static_cast<double>(pgin.captured(1).toULongLong()) *
|
||||||
pageKib);
|
pageKib);
|
||||||
}
|
}
|
||||||
if (pgout.hasMatch()) {
|
if (pgout.hasMatch()) {
|
||||||
writeKib = static_cast<quint64>(static_cast<double>(
|
writeKib = static_cast<quint64>(
|
||||||
pgout.captured(1).toULongLong()) *
|
static_cast<double>(pgout.captured(1).toULongLong()) *
|
||||||
pageKib);
|
pageKib);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -793,8 +793,7 @@ void ProcessModel::scanChunk(
|
|||||||
nowTicks > prevTicks ? nowTicks - prevTicks : 0;
|
nowTicks > prevTicks ? nowTicks - prevTicks : 0;
|
||||||
entry.cpuPercent =
|
entry.cpuPercent =
|
||||||
(static_cast<double>(deltaTicks) /
|
(static_cast<double>(deltaTicks) /
|
||||||
(ctx.deltaSecs *
|
(ctx.deltaSecs * static_cast<double>(ctx.clockTicksPerSec))) *
|
||||||
static_cast<double>(ctx.clockTicksPerSec))) *
|
|
||||||
100.0;
|
100.0;
|
||||||
} else {
|
} else {
|
||||||
entry.cpuPercent = 0.0;
|
entry.cpuPercent = 0.0;
|
||||||
@@ -839,7 +838,8 @@ ProcessModel::ScanResult ProcessModel::scanProcesses(
|
|||||||
// syscall-bound (open/read/close per file per process) and serializes
|
// syscall-bound (open/read/close per file per process) and serializes
|
||||||
// badly on large systems. Keep one pool thread free for this function,
|
// badly on large systems. Keep one pool thread free for this function,
|
||||||
// which itself runs inside the global pool.
|
// which itself runs inside the global pool.
|
||||||
int nThreads = qMin(16, QThreadPool::globalInstance()->maxThreadCount() - 1);
|
int nThreads =
|
||||||
|
qMin(16, QThreadPool::globalInstance()->maxThreadCount() - 1);
|
||||||
if (pids.size() < 128 || nThreads < 2) {
|
if (pids.size() < 128 || nThreads < 2) {
|
||||||
nThreads = 1;
|
nThreads = 1;
|
||||||
}
|
}
|
||||||
@@ -860,8 +860,8 @@ ProcessModel::ScanResult ProcessModel::scanProcesses(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
chunks[t] = pids.mid(a, b - a);
|
chunks[t] = pids.mid(a, b - a);
|
||||||
futures.append(QtConcurrent::run(
|
futures.append(
|
||||||
[&ctx, &chunks, &outs, &uidParts, t]() {
|
QtConcurrent::run([&ctx, &chunks, &outs, &uidParts, t]() {
|
||||||
scanChunk(ctx, chunks[t], outs[t], uidParts[t]);
|
scanChunk(ctx, chunks[t], outs[t], uidParts[t]);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -880,8 +880,9 @@ ProcessModel::ScanResult ProcessModel::scanProcesses(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::sort(
|
std::sort(
|
||||||
fresh.begin(), fresh.end(), [](const ProcessEntry& a,
|
fresh.begin(),
|
||||||
const ProcessEntry& b) {
|
fresh.end(),
|
||||||
|
[](const ProcessEntry& a, const ProcessEntry& b) {
|
||||||
return a.pid < b.pid;
|
return a.pid < b.pid;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1012,8 +1013,8 @@ void ProcessModel::applyView() {
|
|||||||
const FuzzyText prep = fuzzyPrepare(src.command);
|
const FuzzyText prep = fuzzyPrepare(src.command);
|
||||||
fe.commandChars = std::move(prep.chars);
|
fe.commandChars = std::move(prep.chars);
|
||||||
fe.commandClasses = std::move(prep.classes);
|
fe.commandClasses = std::move(prep.classes);
|
||||||
fe.hasCommandLine =
|
fe.hasCommandLine = !src.commandLine.isEmpty() &&
|
||||||
!src.commandLine.isEmpty() && src.commandLine != src.command;
|
src.commandLine != src.command;
|
||||||
if (fe.hasCommandLine) {
|
if (fe.hasCommandLine) {
|
||||||
const FuzzyText prepCl = fuzzyPrepare(src.commandLine);
|
const FuzzyText prepCl = fuzzyPrepare(src.commandLine);
|
||||||
fe.commandLineChars = std::move(prepCl.chars);
|
fe.commandLineChars = std::move(prepCl.chars);
|
||||||
|
|||||||
Reference in New Issue
Block a user