1 /* 2 * Copyright (c) 2018-2019, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file cm_event_ex_base.h 24 //! \brief Contains Class CmEventExBase definitions 25 //! 26 #pragma once 27 28 #include "cm_event.h" 29 30 class CmKernelEx; 31 typedef struct _CM_HAL_STATE CM_HAL_STATE; 32 class CmTracker; 33 34 namespace CMRT_UMD 35 { 36 class CmNotifierGroup; 37 }; 38 class CmEventExBase : public CMRT_UMD::CmEvent 39 { 40 public: 41 virtual int32_t GetExecutionTime(uint64_t &time); 42 GetSurfaceDetails(uint32_t kernIndex,uint32_t surfBTI,CM_SURFACE_DETAILS & outDetails)43 virtual int32_t GetSurfaceDetails(uint32_t kernIndex, uint32_t surfBTI, CM_SURFACE_DETAILS& outDetails) 44 { 45 return CM_NOT_IMPLEMENTED; 46 } 47 GetProfilingInfo(CM_EVENT_PROFILING_INFO infoType,size_t paramSize,void * inputValue,void * value)48 virtual int32_t GetProfilingInfo(CM_EVENT_PROFILING_INFO infoType, size_t paramSize, void *inputValue, void *value) 49 { 50 return CM_NOT_IMPLEMENTED; 51 } 52 53 virtual int32_t GetExecutionTickTime(uint64_t &ticks); 54 SetNotifier(CMRT_UMD::CmNotifierGroup * notifier)55 void SetNotifier(CMRT_UMD::CmNotifierGroup *notifier) {m_notifier = notifier; } 56 57 protected: CmEventExBase(CM_HAL_STATE * state,uint32_t id,CmTracker * tracker)58 CmEventExBase(CM_HAL_STATE *state, uint32_t id, CmTracker *tracker): 59 m_taskId(id), 60 m_cmTracker(tracker), 61 m_cmhal(state), 62 m_start(0), 63 m_end(0), 64 m_state(CM_STATUS_RESET), 65 m_osData(nullptr), 66 m_notifier(nullptr) 67 { 68 } 69 70 virtual ~CmEventExBase(); 71 72 CM_STATUS Query(); 73 RleaseOsData()74 virtual void RleaseOsData() {} 75 76 uint32_t m_taskId; 77 CmTracker *m_cmTracker; 78 79 CM_HAL_STATE *m_cmhal; 80 81 uint64_t m_start; 82 uint64_t m_end; 83 CM_STATUS m_state; 84 85 void *m_osData; 86 87 CMRT_UMD::CmNotifierGroup *m_notifier; 88 89 private: 90 bool LogTimestamps(const char *callerFunctionName, int callerLineNumber); 91 }; 92