github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/common/include/profiling.h (about) 1 /* 2 * Copyright (c) 2013 Intel Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * Unless required by applicable law or agreed to in writing, software 9 * distributed under the License is distributed on an "AS IS" BASIS, 10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 * See the License for the specific language governing permissions and 12 * limitations under the License. 13 */ 14 15 #ifndef _PROFILING_H 16 #define _PROFILING_H 17 18 #ifdef ENABLE_TMSL_PROFILING 19 20 #include "profiling_defs.h" 21 22 23 // Definitions for tmsl profiling 24 25 #define HANDLER_REPORT_EVENT handler_profiling_report_event 26 #define TMSL_PROFILING_API_ENTRY(__api_id, __caller) \ 27 {\ 28 profiling_api(PROF_POSITION_ENTRY, __api_id, __caller);\ 29 } 30 #define TMSL_PROFILING_API_EXIT(__api_id, __caller) \ 31 {\ 32 profiling_api(PROF_POSITION_EXIT, __api_id, __caller);\ 33 } 34 #define TMSL_PROFILING_FUNC_ENTRY(__func_id) \ 35 {\ 36 profiling_func(PROF_POSITION_ENTRY, __func_id);\ 37 } 38 #define TMSL_PROFILING_FUNC_EXIT(__func_id) \ 39 {\ 40 profiling_func(PROF_POSITION_EXIT, __func_id);\ 41 } 42 #define TMSL_PROFILING_VMEXIT() \ 43 {\ 44 profiling_vmexit();\ 45 } 46 #define TMSL_PROFILING_MEMORY_ALLOC(__addr, __size, __context) \ 47 {\ 48 profiling_memory(__addr, __size, PROF_MEM_ACTION_ALLOC, __context);\ 49 } 50 #define TMSL_PROFILING_MEMORY_FREE(__addr, __context) \ 51 {\ 52 profiling_memory(__addr, 0, PROF_MEM_ACTION_FREE, __context);\ 53 } 54 #define TMSL_PROFILING_INIT(__cpu_num) \ 55 {\ 56 tmsl_profiling_init(__cpu_num);\ 57 } 58 59 void tmsl_profiling_init(UINT16 cpu_num); 60 void handler_profiling_report_event(void *p_event_info); 61 void profiling_memory(UINT64 addr, UINT64 size, PROF_MEM_ACTION_TYPE type, PROF_MEM_CONTEXT_TYPE context); 62 void profiling_vmexit(void); 63 void profiling_api(PROF_POSITION_TYPE position, UINT32 api_id, PROF_API_CALLER_TYPE caller); 64 void profiling_func(PROF_POSITION_TYPE position, UINT32 func_id); 65 void profiling_custom_tag(UINT32 tag); 66 67 #else 68 69 #define TMSL_PROFILING_API_ENTRY(__api_id, __caller) 70 #define TMSL_PROFILING_API_EXIT(__api_id, __caller) 71 #define TMSL_PROFILING_FUNC_ENTRY(__func_id) 72 #define TMSL_PROFILING_FUNC_EXIT(__func_id) 73 #define TMSL_PROFILING_VMEXIT() 74 #define TMSL_PROFILING_MEMORY_ALLOC(__addr, __size, __context) 75 #define TMSL_PROFILING_MEMORY_FREE(__addr, __context) 76 #define TMSL_PROFILING_INIT(__cpu_num) 77 #endif 78 79 80 #endif //_PROFILING_H