Maxim Integrated / Mbed OS MAXREFDES220#

Dependencies:   USBDevice max32630fthr

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