From 6b3691c8762320df5afc8a7e79b9da09e272695b Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Mon, 3 Oct 2016 16:39:10 -0500 Subject: [PATCH] swr: [rasterizer common] remove threadviz code Signed-off-by: Tim Rowley --- .../swr/rasterizer/common/rdtsc_buckets.cpp | 49 ------------------- .../swr/rasterizer/common/rdtsc_buckets.h | 38 -------------- .../swr/rasterizer/scripts/knob_defs.py | 7 --- 3 files changed, 94 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp index 288b0719a04..79e82c4e6b3 100644 --- a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp +++ b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp @@ -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"); diff --git a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h index e50a8a546c4..48042ac2233 100644 --- a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h +++ b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h @@ -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; }; diff --git a/src/gallium/drivers/swr/rasterizer/scripts/knob_defs.py b/src/gallium/drivers/swr/rasterizer/scripts/knob_defs.py index f93147c38da..2f1d1ef02e7 100644 --- a/src/gallium/drivers/swr/rasterizer/scripts/knob_defs.py +++ b/src/gallium/drivers/swr/rasterizer/scripts/knob_defs.py @@ -146,13 +146,6 @@ KNOBS = [ }], - ['BUCKETS_ENABLE_THREADVIZ', { - 'type' : 'bool', - 'default' : 'false', - 'desc' : ['Enable threadviz output.'], - 'category' : 'perf', - }], - ['TOSS_DRAW', { 'type' : 'bool', 'default' : 'false', -- 2.30.2