[Beignet] [PATCH 11/18] Backend: Add more APIs to ProfilingInfo class.

junyan.he at inbox.com junyan.he at inbox.com
Thu Dec 24 03:02:03 PST 2015


From: Junyan He <junyan.he at linux.intel.com>

We want to store more information in ProfilingInfo
in order to output more information with the kernel's
source code.

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 backend/src/ir/profiling.hpp | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/backend/src/ir/profiling.hpp b/backend/src/ir/profiling.hpp
index 8b7690f..d36f978 100644
--- a/backend/src/ir/profiling.hpp
+++ b/backend/src/ir/profiling.hpp
@@ -37,6 +37,13 @@ namespace gbe
     public:
       const static uint32_t MaxTimestampProfilingPoints = 20;
       enum {
+        ProfilingNone = 0,
+        ProfilingSimple,
+        ProfilingNormal,
+        ProfilingVerbose,
+      };
+
+      enum {
         ProfilingSimdType1,
         ProfilingSimdType8,
         ProfilingSimdType16,
@@ -81,13 +88,24 @@ namespace gbe
         this->bti = other.bti;
         this->profilingType = other.profilingType;
         this->deviceID = other.deviceID;
+        this->source = other.source;
+        this->profPoints = other.profPoints;
       }
-
-      ProfilingInfo(void) {
+      ProfilingInfo(ProfilingInfo&& other) = default;
+      ProfilingInfo(void) : source(), profPoints() {
         this->bti = 0;
-        this->profilingType = 0;
+        this->profilingType = ProfilingNone;
         this->deviceID = 0;
       }
+      ProfilingInfo& operator = (const ProfilingInfo& other) {
+        this->bti = other.bti;
+        this->profilingType = other.profilingType;
+        this->deviceID = other.deviceID;
+        this->source = other.source;
+        this->profPoints = other.profPoints;
+        return *this;
+      }
+
       struct LockOutput {
         LockOutput(void) {
           pthread_mutex_lock(&lock);
@@ -117,13 +135,21 @@ namespace gbe
         return deviceID;
       }
       void outputProfilingInfo(void* logBuf);
+      void setSource(const char* source) {
+         if (source) this->source = std::string(source);
+      }
+      void setprofPoints(std::map<uint32_t, uint32_t>& p) {
+         profPoints = p;
+      }
 
     private:
       uint32_t bti;
       uint32_t profilingType;
       uint32_t deviceID;
+      std::string source;
       friend struct LockOutput;
       static pthread_mutex_t lock;
+      std::map<uint32_t, uint32_t> profPoints; // map prof point to source line.
       GBE_CLASS(ProfilingInfo);
     };
   } /* namespace ir */
-- 
1.9.1





More information about the Beignet mailing list