swr: [rasterizer common] remove threadviz code
Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
This commit is contained in:
parent
2550b04179
commit
6b3691c876
|
@ -46,17 +46,6 @@ BucketManager::~BucketManager()
|
|||
|
||||
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 = KNOB_BUCKETS_ENABLE_THREADVIZ;
|
||||
}
|
||||
|
||||
BUCKET_THREAD newThread;
|
||||
newThread.name = name;
|
||||
|
@ -72,15 +61,6 @@ void BucketManager::RegisterThread(const std::string& name)
|
|||
newThread.id = (UINT)id;
|
||||
tlsThreadId = (UINT)id;
|
||||
|
||||
// open threadviz file if enabled
|
||||
if (mThreadViz)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << mThreadVizDir << PATH_SEPARATOR;
|
||||
ss << "threadviz_thread." << newThread.id << ".dat";
|
||||
newThread.vizFile = fopen(ss.str().c_str(), "wb");
|
||||
}
|
||||
|
||||
// store new thread
|
||||
mThreads.push_back(newThread);
|
||||
|
||||
|
@ -171,37 +151,8 @@ void BucketManager::PrintThread(FILE* f, const BUCKET_THREAD& thread)
|
|||
}
|
||||
}
|
||||
|
||||
void BucketManager::DumpThreadViz()
|
||||
{
|
||||
// ensure all thread data is flushed
|
||||
mThreadMutex.lock();
|
||||
for (auto& thread : mThreads)
|
||||
{
|
||||
fflush(thread.vizFile);
|
||||
fclose(thread.vizFile);
|
||||
thread.vizFile = nullptr;
|
||||
}
|
||||
mThreadMutex.unlock();
|
||||
|
||||
// dump bucket descriptions
|
||||
std::stringstream ss;
|
||||
ss << mThreadVizDir << PATH_SEPARATOR << "threadviz_buckets.dat";
|
||||
|
||||
FILE* f = fopen(ss.str().c_str(), "wb");
|
||||
for (auto& bucket : mBuckets)
|
||||
{
|
||||
Serialize(f, bucket);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void BucketManager::PrintReport(const std::string& filename)
|
||||
{
|
||||
if (mThreadViz)
|
||||
{
|
||||
DumpThreadViz();
|
||||
}
|
||||
else
|
||||
{
|
||||
FILE* f = fopen(filename.c_str(), "w");
|
||||
|
||||
|
|
|
@ -55,17 +55,6 @@ public:
|
|||
void ClearThreads()
|
||||
{
|
||||
mThreadMutex.lock();
|
||||
// close out the threadviz files if threadviz is enabled
|
||||
if (KNOB_BUCKETS_ENABLE_THREADVIZ)
|
||||
{
|
||||
for (auto& thread : mThreads)
|
||||
{
|
||||
if (thread.vizFile != nullptr)
|
||||
{
|
||||
fclose(thread.vizFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
mThreads.clear();
|
||||
mThreadMutex.unlock();
|
||||
}
|
||||
|
@ -88,9 +77,6 @@ public:
|
|||
/// @return unique id
|
||||
UINT RegisterBucket(const BUCKET_DESC& desc);
|
||||
|
||||
// dump threadviz data
|
||||
void DumpThreadViz();
|
||||
|
||||
// print report
|
||||
void PrintReport(const std::string& filename);
|
||||
|
||||
|
@ -134,17 +120,6 @@ public:
|
|||
|
||||
uint64_t tsc = __rdtsc();
|
||||
|
||||
// if threadviz is enabled, only need to dump start info to threads viz file
|
||||
if (mThreadViz)
|
||||
{
|
||||
SWR_ASSERT(bt.vizFile != nullptr);
|
||||
if (mBuckets[id].enableThreadViz)
|
||||
{
|
||||
VIZ_START_DATA data{ VIZ_START, id, tsc };
|
||||
Serialize(bt.vizFile, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bt.pCurrent->children.size() < mBuckets.size())
|
||||
{
|
||||
|
@ -176,16 +151,6 @@ public:
|
|||
|
||||
uint64_t tsc = __rdtsc();
|
||||
|
||||
if (mThreadViz)
|
||||
{
|
||||
SWR_ASSERT(bt.vizFile != nullptr);
|
||||
if (mBuckets[id].enableThreadViz)
|
||||
{
|
||||
VIZ_STOP_DATA data{ VIZ_STOP, tsc };
|
||||
Serialize(bt.vizFile, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bt.pCurrent->start == 0) return;
|
||||
SWR_ASSERT(bt.pCurrent->id == id, "Mismatched buckets detected");
|
||||
|
@ -209,7 +174,6 @@ public:
|
|||
BUCKET_THREAD& bt = mThreads[tlsThreadId];
|
||||
|
||||
// don't record events for threadviz
|
||||
if (!mThreadViz)
|
||||
{
|
||||
if (bt.pCurrent->children.size() < mBuckets.size())
|
||||
{
|
||||
|
@ -240,8 +204,6 @@ private:
|
|||
|
||||
std::mutex mThreadMutex;
|
||||
|
||||
// enable threadviz
|
||||
bool mThreadViz{ false };
|
||||
std::string mThreadVizDir;
|
||||
|
||||
};
|
||||
|
|
|
@ -146,13 +146,6 @@ KNOBS = [
|
|||
}],
|
||||
|
||||
|
||||
['BUCKETS_ENABLE_THREADVIZ', {
|
||||
'type' : 'bool',
|
||||
'default' : 'false',
|
||||
'desc' : ['Enable threadviz output.'],
|
||||
'category' : 'perf',
|
||||
}],
|
||||
|
||||
['TOSS_DRAW', {
|
||||
'type' : 'bool',
|
||||
'default' : 'false',
|
||||
|
|
Loading…
Reference in New Issue