Added DatabasePager::setProcessorAffinity(const OpenThreads::Affinity&) support to allow the database threads to have affinity to user controls sets of CPU cores.
This commit is contained in:
parent
171e4f0f29
commit
77c5e96ccb
@ -126,6 +126,10 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual void setProcessorAffinty(const OpenThreads::Affinity& affinity);
|
||||||
|
OpenThreads::Affinity& getProcessorAffinty() { return _affinity; }
|
||||||
|
const OpenThreads::Affinity& getProcessorAffinty() const { return _affinity; }
|
||||||
|
|
||||||
void setUpThreads(unsigned int totalNumThreads=2, unsigned int numHttpThreads=1);
|
void setUpThreads(unsigned int totalNumThreads=2, unsigned int numHttpThreads=1);
|
||||||
|
|
||||||
virtual unsigned int addDatabaseThread(DatabaseThread::Mode mode, const std::string& name);
|
virtual unsigned int addDatabaseThread(DatabaseThread::Mode mode, const std::string& name);
|
||||||
@ -438,6 +442,8 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
|||||||
void addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp);
|
void addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp);
|
||||||
|
|
||||||
|
|
||||||
|
OpenThreads::Affinity _affinity;
|
||||||
|
|
||||||
bool _done;
|
bool _done;
|
||||||
bool _acceptNewRequests;
|
bool _acceptNewRequests;
|
||||||
bool _databasePagerThreadPaused;
|
bool _databasePagerThreadPaused;
|
||||||
|
@ -1107,6 +1107,9 @@ DatabasePager::DatabasePager()
|
|||||||
_dataToCompileList = new RequestQueue(this);
|
_dataToCompileList = new RequestQueue(this);
|
||||||
_dataToMergeList = new RequestQueue(this);
|
_dataToMergeList = new RequestQueue(this);
|
||||||
|
|
||||||
|
// test of setting the database threads affinity.
|
||||||
|
// _affinity = OpenThreads::Affinity(4,4);
|
||||||
|
|
||||||
setUpThreads(
|
setUpThreads(
|
||||||
osg::DisplaySettings::instance()->getNumOfDatabaseThreadsHint(),
|
osg::DisplaySettings::instance()->getNumOfDatabaseThreadsHint(),
|
||||||
osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint());
|
osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint());
|
||||||
@ -1187,6 +1190,8 @@ DatabasePager::DatabasePager(const DatabasePager& rhs)
|
|||||||
_databaseThreads.push_back(new DatabaseThread(**dt_itr,this));
|
_databaseThreads.push_back(new DatabaseThread(**dt_itr,this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setProcessorAffinty(rhs.getProcessorAffinty());
|
||||||
|
|
||||||
_activePagedLODList = rhs._activePagedLODList->clone();
|
_activePagedLODList = rhs._activePagedLODList->clone();
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
@ -1244,6 +1249,18 @@ DatabasePager* DatabasePager::create()
|
|||||||
new DatabasePager;
|
new DatabasePager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabasePager::setProcessorAffinty(const OpenThreads::Affinity& affinity)
|
||||||
|
{
|
||||||
|
_affinity = affinity;
|
||||||
|
|
||||||
|
for(DatabaseThreadList::iterator itr=_databaseThreads.begin();
|
||||||
|
itr != _databaseThreads.end();
|
||||||
|
++itr)
|
||||||
|
{
|
||||||
|
(*itr)->setProcessorAffinity(_affinity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DatabasePager::setUpThreads(unsigned int totalNumThreads, unsigned int numHttpThreads)
|
void DatabasePager::setUpThreads(unsigned int totalNumThreads, unsigned int numHttpThreads)
|
||||||
{
|
{
|
||||||
_databaseThreads.clear();
|
_databaseThreads.clear();
|
||||||
@ -1280,6 +1297,9 @@ unsigned int DatabasePager::addDatabaseThread(DatabaseThread::Mode mode, const s
|
|||||||
unsigned int pos = _databaseThreads.size();
|
unsigned int pos = _databaseThreads.size();
|
||||||
|
|
||||||
DatabaseThread* thread = new DatabaseThread(this, mode,name);
|
DatabaseThread* thread = new DatabaseThread(this, mode,name);
|
||||||
|
|
||||||
|
thread->setProcessorAffinity(_affinity);
|
||||||
|
|
||||||
_databaseThreads.push_back(thread);
|
_databaseThreads.push_back(thread);
|
||||||
|
|
||||||
if (_startThreadCalled)
|
if (_startThreadCalled)
|
||||||
|
Loading…
Reference in New Issue
Block a user