Need to do lazy eval of the threadviz knob since order of globals
is undefined.
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
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());
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()
/// @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;