Commit c2f5d2da authored by Tim Rowley's avatar Tim Rowley

swr: [rasterizer core] Fix threadviz support in buckets

Need to do lazy eval of the threadviz knob since order of globals
is undefined.
Reviewed-by: Bruce Cherniak's avatarBruce Cherniak <bruce.cherniak@intel.com>
parent 1eb211c4
......@@ -34,6 +34,18 @@ THREAD UINT tlsThreadId = 0;
void BucketManager::RegisterThread(const std::string& name)
{
// lazy evaluate threadviz knob
if (!mThreadViz && KNOB_BUCKETS_ENABLE_THREADVIZ)
{
uint32_t pid = GetCurrentProcessId();
std::stringstream str;
str << "threadviz." << pid;
mThreadVizDir = str.str();
CreateDirectory(mThreadVizDir.c_str(), NULL);
mThreadViz = true;
}
BUCKET_THREAD newThread;
newThread.name = name;
newThread.root.children.reserve(mBuckets.size());
......
......@@ -47,17 +47,7 @@ extern THREAD UINT tlsThreadId;
class BucketManager
{
public:
BucketManager(bool enableThreadViz) : mThreadViz(enableThreadViz)
{
if (mThreadViz)
{
uint32_t pid = GetCurrentProcessId();
std::stringstream str;
str << "threadviz." << pid;
mThreadVizDir = str.str();
CreateDirectory(mThreadVizDir.c_str(), NULL);
}
}
BucketManager() { }
// removes all registered thread data
void ClearThreads()
......
......@@ -90,6 +90,6 @@ BUCKET_DESC gCoreBuckets[] = {
/// @todo bucketmanager and mapping should probably be a part of the SWR context
std::vector<uint32_t> gBucketMap;
BucketManager gBucketMgr(KNOB_BUCKETS_ENABLE_THREADVIZ);
BucketManager gBucketMgr;
uint32_t gCurrentFrame = 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment