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.
Dependents: nucleo_encoder_stepper mbed-os-rest-api-V1-1
CPU_Usage.h
00001 /****************************************************** 00002 CPU_Usage Library V1.0 Ian Weston 15.06.2014 00003 CPU_Usage Library V1.01 Ian Weston 08.01.2016 00004 00005 A very lightweight tool for calculating the CPU usage 00006 of the mbed micro. Based in the time domain, this will 00007 calculate the percentage of CPU time used. 00008 00009 Please see the project page for more details. 00010 00011 Enjoy! 00012 00013 ******************************************************/ 00014 00015 #include "mbed.h" 00016 00017 #ifndef CPU_USAGE_H 00018 #define CPU_USAGE_H 00019 00020 00021 class CPU_Usage { 00022 00023 private: 00024 00025 // Declare Private variables //// 00026 Timer *_t; 00027 float _active; 00028 float _inactive; 00029 float _time_ballast; 00030 00031 public: 00032 00033 // Constructor ////////////////// 00034 CPU_Usage( Timer &_t , float time_ballast); 00035 00036 // Class Function Prototypes //// 00037 void working (void); 00038 void stopped (void); 00039 uint8_t update (void); 00040 void delay (float duration); 00041 00042 // Destructor ////////////////// 00043 ~CPU_Usage(void); 00044 00045 }; 00046 00047 00048 00049 #endif
Generated on Thu Jul 14 2022 06:11:45 by
1.7.2