MCPcopy Create free account
hub / github.com/benapetr/TuxManager / sampleProcessStats

Method sampleProcessStats

src/system/kernel.cpp:31–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void Kernel::sampleProcessStats()
32{
33 int procs = 0, threads = 0;
34 const QDir procDir("/proc");
35 for (const QString &entry : procDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
36 {
37 bool ok;
38 entry.toInt(&ok);
39 if (!ok)
40 continue;
41 ++procs;
42 // Each thread appears as a subdirectory entry under /proc/<pid>/task/
43 const QDir taskDir(QString("/proc/%1/task").arg(entry));
44 // count() includes "." and ".." so subtract 2
45 threads += static_cast<int>(taskDir.count()) - 2;
46 }
47 this->m_processCount = procs;
48 this->m_threadCount = qMax(0, threads);
49}
50

Callers 1

SampleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected