Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FXAS21002 FXOS8700Q
fcc_time_profiling.h
00001 // ---------------------------------------------------------------------------- 00002 // Copyright 2016-2017 ARM Ltd. 00003 // 00004 // Licensed under the Apache License, Version 2.0 (the "License"); 00005 // you may not use this file except in compliance with the License. 00006 // You may obtain a copy of the License at 00007 // 00008 // http://www.apache.org/licenses/LICENSE-2.0 00009 // 00010 // Unless required by applicable law or agreed to in writing, software 00011 // distributed under the License is distributed on an "AS IS" BASIS, 00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 // See the License for the specific language governing permissions and 00014 // limitations under the License. 00015 // ---------------------------------------------------------------------------- 00016 00017 #ifndef __FCC_TIME_PROFILING_H__ 00018 #define __FCC_TIME_PROFILING_H__ 00019 00020 #include <inttypes.h> 00021 #include <stdbool.h> 00022 #include <string.h> 00023 #include "mbed-trace/mbed_trace.h" 00024 #include "pal.h" 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 00031 #ifdef FCC_TIME_PROFILING 00032 00033 extern uint64_t fcc_gen_timer; 00034 extern uint64_t fcc_bundle_timer; 00035 extern uint64_t fcc_key_timer; 00036 extern uint64_t fcc_certificate_timer; 00037 extern uint64_t fcc_config_param_timer; 00038 extern uint64_t fcc_certificate_chain_timer; 00039 extern uint64_t fcc_generate_csr_timer; 00040 00041 void calculate_time(const char *label, size_t size, uint64_t ticks); 00042 00043 00044 #define TRACE_GROUP "fcc" 00045 00046 /** 00047 * Init timer 00048 * 00049 * Note: when used for the first time, a delay of 1 sec added for ticks calculation. This delay should be subtracted 00050 * from the time calculation 00051 */ 00052 #define FCC_INIT_TIMER(ticks) calculate_time("",0,pal_osKernelSysTick() - ticks) 00053 /** 00054 * Start timer 00055 */ 00056 #define FCC_SET_START_TIMER(ticks) ticks=pal_osKernelSysTick(); 00057 00058 /** 00059 * End timer, print label and the calculated result. 00060 * If the label is string "size" should be 0, and if the label is buffer - "size" should be the size of buffer to print. 00061 * 00062 * Note: when used for the first time, a delay of 1 sec added for ticks calculation. This delay should be subtracted 00063 * from the time calculation 00064 */ 00065 #define FCC_END_TIMER(label,size, ticks) calculate_time(label,size,pal_osKernelSysTick() - ticks) 00066 /** 00067 * The function calculates time from started timer, prints the label as string or as buffer with size and the calulated time. 00068 **/ 00069 00070 #else 00071 #define FCC_INIT_TIMER(ticks) do {} while (0) 00072 #define FCC_SET_START_TIMER(ticks) do {} while (0) 00073 #define FCC_END_TIMER(label, size, ticks) do {} while (0) 00074 #endif 00075 #ifdef __cplusplus 00076 } 00077 #endif 00078 00079 #endif // __PV_MACROS_H__ 00080
Generated on Tue Jul 12 2022 11:18:12 by
1.7.2