Arun Raj / Mbed OS MAXREFDES101_SOURCE

Dependencies:   max32630fthr Adafruit_FeatherOLED USBDevice

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EventStats.h Source File

EventStats.h

00001 /*******************************************************************************
00002  * Author: Shaun Kelsey, shaun.kelsey@maximintegrated.com
00003 
00004  * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the "Software"),
00008  * to deal in the Software without restriction, including without limitation
00009  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00010  * and/or sell copies of the Software, and to permit persons to whom the
00011  * Software is furnished to do so, subject to the following conditions:
00012  *
00013  * The above copyright notice and this permission notice shall be included
00014  * in all copies or substantial portions of the Software.
00015  *
00016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00017  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00019  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
00020  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00021  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00022  * OTHER DEALINGS IN THE SOFTWARE.
00023  *
00024  * Except as contained in this notice, the name of Maxim Integrated
00025  * Products, Inc. shall not be used except as stated in the Maxim Integrated
00026  * Products, Inc. Branding Policy.
00027  *
00028  * The mere transfer of this software does not imply any licenses
00029  * of trade secrets, proprietary technology, copyrights, patents,
00030  * trademarks, maskwork rights, or any other form of intellectual
00031  * property whatsoever. Maxim Integrated Products, Inc. retains all
00032  * ownership rights.
00033  *
00034  ******************************************************************************/
00035 #ifdef ENABLE_EVENTSTATS
00036 #ifndef _PLATFORM_EVENT_H
00037 #define _PLATFORM_EVENT_H
00038 
00039 
00040 #include "mbed.h"
00041 
00042 class EventStats
00043 {
00044     public:
00045         EventStats();
00046         EventStats(int report_period, const char* name);
00047 
00048         //Start an event
00049         void start();
00050 
00051         //Stop an event. If report_period time has passed, prints stats
00052         void stop();
00053 
00054         //Print out stats. Set report_period to < 0 if you want to call this manually
00055         void print_events(bool reset);
00056 
00057     private:
00058 
00059         const char* name;
00060         int report_period;
00061         int num_evts;
00062         int total_evt_time;
00063 
00064         bool evt_in_prog;
00065         Timer single_evt;
00066         Timer all_evts;
00067 };
00068 
00069 
00070 #endif
00071 #endif //ENABLE_EVENTSTATS