Skip to content
Snippets Groups Projects

ProcStats : Use mutex lock to make fetch() thread safe.

Merged Christopher Rob Jones requested to merge jonrob/Gaudi:ProcStats-thread-safe into master
All threads resolved!
Compare and Show latest version
1 file
+ 5
4
Compare changes
  • Side-by-side
  • Inline
@@ -285,10 +285,11 @@ bool ProcStats::fetch( procInfo& f ) {
&pinfo.kstkesp, &pinfo.kstkeip, &pinfo.signal, &pinfo.blocked, &pinfo.sigignore, &pinfo.sigcatch,
&pinfo.wchan );
// resident set size in pages
const auto pr_size = static_cast<double>( pinfo.vsize );
const auto pr_rssize = static_cast<double>( pinfo.rss );
f.vsize = pr_size / ( 1024 * 1024 );
f.rss = pr_rssize * m_pg_size / ( 1024 * 1024 );
const auto pr_size = static_cast<double>( pinfo.vsize );
const auto pr_rssize = static_cast<double>( pinfo.rss );
constexpr double MB = 1.0 / ( 1024 * 1024 );
f.vsize = pr_size * MB;
f.rss = pr_rssize * m_pg_size * MB;
if ( 0 == pinfo.vsize ) { ok = false; }
}
return ok;
Loading