swr: [rasterizer common] remove threadviz code
authorTim Rowley <timothy.o.rowley@intel.com>
Mon, 3 Oct 2016 21:39:10 +0000 (16:39 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Tue, 11 Oct 2016 16:22:04 +0000 (11:22 -0500)
Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h
src/gallium/drivers/swr/rasterizer/scripts/knob_defs.py

index 288b0719a047ff23175de5e8330b302460a01a26..79e82c4e6b373c2b7533ceec3b16aff14dbcbfb3 100644 (file)
@@ -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");
 
index e50a8a546c4bed657617992dd3ee403efa9b707a..48042ac223394cd1f9f1774929e98b636189e36d 100644 (file)
@@ -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;
 
 };
index f93147c38daa421bb0682f32c73574f2ca171f0b..2f1d1ef02e760b527a96aa18f85afeabdbe449c9 100644 (file)
@@ -146,13 +146,6 @@ KNOBS = [
     }],
 
 
-    ['BUCKETS_ENABLE_THREADVIZ', {
-        'type'      : 'bool',
-        'default'   : 'false',
-        'desc'      : ['Enable threadviz output.'],
-        'category'  : 'perf',
-    }],
-
     ['TOSS_DRAW', {
         'type'      : 'bool',
         'default'   : 'false',