1 /*
2 * Copyright (c) 2007-2017, 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_task_internal_os.cpp
24 //! \brief Contains Class CmTaskInternal definitions
25 //!
26
27 #include "cm_task_internal.h"
28
29 #include "cm_ftrace.h"
30 #include "cm_device_rt.h"
31 #include "cm_event_rt.h"
32
33 namespace CMRT_UMD
34 {
35 //*-----------------------------------------------------------------------------
36 //| Purpose: Write task info into trace_marker
37 //| Returns: Result of operation.
38 //*-----------------------------------------------------------------------------
VtuneWriteEventInfo()39 int32_t CmTaskInternal::VtuneWriteEventInfo()
40 {
41 if(!m_cmDevice->IsVtuneLogOn())
42 { // return directly if ETW log is off
43 return CM_SUCCESS;
44 }
45
46 if (m_taskProfilingInfo.kernelCount == 0 ||
47 m_taskProfilingInfo.kernelNames == nullptr)
48 {
49 //Skip ETW Write since information is not filled
50 //Vebox/EnqueueWithHints
51 return CM_SUCCESS;
52 }
53
54 //Get Complete Time
55 m_taskEvent->GetCompleteTime(&m_taskProfilingInfo.completeTime);
56
57 //Get HW start/end Time
58 m_taskEvent->GetHWStartTime(&m_taskProfilingInfo.hwStartTime);
59 m_taskEvent->GetHWEndTime(&m_taskProfilingInfo.hwEndTime);
60 CmFtrace *ftrace = CmFtrace::GetInstance();
61 if (ftrace == nullptr)
62 {
63 return CM_NULL_POINTER;
64 }
65 ftrace->WriteTaskProfilingInfo(&m_taskProfilingInfo);
66
67 return CM_SUCCESS;
68 }
69 } // namespace
70