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.
Fork of mbed-os-example-mbed5-blinky by
baidu_measure_time.h
00001 #ifndef __MEASURETIME_H__ 00002 #define __MEASURETIME_H__ 00003 #include "us_ticker_api.h" 00004 00005 #define ArraySize 20 00006 00007 #define print_error printf 00008 00009 namespace baidu{ 00010 namespace os{ 00011 00012 typedef struct __MeasureValue{ 00013 unsigned int total_cnt; 00014 unsigned int cur_cnt; 00015 unsigned int time_begin; 00016 unsigned int time_sum; 00017 unsigned int time_min; 00018 unsigned int time_max; 00019 unsigned int arg_value; 00020 }MeasureValue; 00021 00022 typedef unsigned int (*TimeFuncPtr)(void); 00023 00024 // this class is not thread-safe 00025 class MeasureTime{ 00026 public: 00027 static MeasureTime* getInstMeasureTime(TimeFuncPtr time_func); 00028 void addMeasureValue(int key, int count); 00029 void updateMeasureValue(int key, int arg_value, int continuous_measure_flag); 00030 void outputResult(); 00031 00032 private: 00033 MeasureTime(TimeFuncPtr time_func); 00034 MeasureTime(const MeasureTime&); 00035 MeasureTime& operator=(const MeasureTime&); 00036 00037 private: 00038 static MeasureTime* _instance; 00039 static TimeFuncPtr _time_func; 00040 MeasureValue MeasureArray[ArraySize]; 00041 }; 00042 00043 } //namespace os 00044 } //namespace baidu 00045 #endif //~__MEASURETIME_H__
Generated on Tue Jul 12 2022 16:28:52 by
1.7.2
