TEST

Dependencies:   max32630fthr Adafruit_FeatherOLED USBDevice

Committer:
wwwarunraj
Date:
Sun Apr 19 11:19:57 2020 +0000
Revision:
4:291477e8690d
Parent:
1:f60eafbf009a
19/04

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gmehmet 1:f60eafbf009a 1 /*******************************************************************************
gmehmet 1:f60eafbf009a 2 * Author: Shaun Kelsey, shaun.kelsey@maximintegrated.com
gmehmet 1:f60eafbf009a 3
gmehmet 1:f60eafbf009a 4 * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
gmehmet 1:f60eafbf009a 5 *
gmehmet 1:f60eafbf009a 6 * Permission is hereby granted, free of charge, to any person obtaining a
gmehmet 1:f60eafbf009a 7 * copy of this software and associated documentation files (the "Software"),
gmehmet 1:f60eafbf009a 8 * to deal in the Software without restriction, including without limitation
gmehmet 1:f60eafbf009a 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
gmehmet 1:f60eafbf009a 10 * and/or sell copies of the Software, and to permit persons to whom the
gmehmet 1:f60eafbf009a 11 * Software is furnished to do so, subject to the following conditions:
gmehmet 1:f60eafbf009a 12 *
gmehmet 1:f60eafbf009a 13 * The above copyright notice and this permission notice shall be included
gmehmet 1:f60eafbf009a 14 * in all copies or substantial portions of the Software.
gmehmet 1:f60eafbf009a 15 *
gmehmet 1:f60eafbf009a 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
gmehmet 1:f60eafbf009a 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
gmehmet 1:f60eafbf009a 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
gmehmet 1:f60eafbf009a 19 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
gmehmet 1:f60eafbf009a 20 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
gmehmet 1:f60eafbf009a 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
gmehmet 1:f60eafbf009a 22 * OTHER DEALINGS IN THE SOFTWARE.
gmehmet 1:f60eafbf009a 23 *
gmehmet 1:f60eafbf009a 24 * Except as contained in this notice, the name of Maxim Integrated
gmehmet 1:f60eafbf009a 25 * Products, Inc. shall not be used except as stated in the Maxim Integrated
gmehmet 1:f60eafbf009a 26 * Products, Inc. Branding Policy.
gmehmet 1:f60eafbf009a 27 *
gmehmet 1:f60eafbf009a 28 * The mere transfer of this software does not imply any licenses
gmehmet 1:f60eafbf009a 29 * of trade secrets, proprietary technology, copyrights, patents,
gmehmet 1:f60eafbf009a 30 * trademarks, maskwork rights, or any other form of intellectual
gmehmet 1:f60eafbf009a 31 * property whatsoever. Maxim Integrated Products, Inc. retains all
gmehmet 1:f60eafbf009a 32 * ownership rights.
gmehmet 1:f60eafbf009a 33 *
gmehmet 1:f60eafbf009a 34 ******************************************************************************/
gmehmet 1:f60eafbf009a 35 #ifdef ENABLE_EVENTSTATS
gmehmet 1:f60eafbf009a 36 #ifndef _PLATFORM_EVENT_H
gmehmet 1:f60eafbf009a 37 #define _PLATFORM_EVENT_H
gmehmet 1:f60eafbf009a 38
gmehmet 1:f60eafbf009a 39
gmehmet 1:f60eafbf009a 40 #include "mbed.h"
gmehmet 1:f60eafbf009a 41
gmehmet 1:f60eafbf009a 42 class EventStats
gmehmet 1:f60eafbf009a 43 {
gmehmet 1:f60eafbf009a 44 public:
gmehmet 1:f60eafbf009a 45 EventStats();
gmehmet 1:f60eafbf009a 46 EventStats(int report_period, const char* name);
gmehmet 1:f60eafbf009a 47
gmehmet 1:f60eafbf009a 48 //Start an event
gmehmet 1:f60eafbf009a 49 void start();
gmehmet 1:f60eafbf009a 50
gmehmet 1:f60eafbf009a 51 //Stop an event. If report_period time has passed, prints stats
gmehmet 1:f60eafbf009a 52 void stop();
gmehmet 1:f60eafbf009a 53
gmehmet 1:f60eafbf009a 54 //Print out stats. Set report_period to < 0 if you want to call this manually
gmehmet 1:f60eafbf009a 55 void print_events(bool reset);
gmehmet 1:f60eafbf009a 56
gmehmet 1:f60eafbf009a 57 private:
gmehmet 1:f60eafbf009a 58
gmehmet 1:f60eafbf009a 59 const char* name;
gmehmet 1:f60eafbf009a 60 int report_period;
gmehmet 1:f60eafbf009a 61 int num_evts;
gmehmet 1:f60eafbf009a 62 int total_evt_time;
gmehmet 1:f60eafbf009a 63
gmehmet 1:f60eafbf009a 64 bool evt_in_prog;
gmehmet 1:f60eafbf009a 65 Timer single_evt;
gmehmet 1:f60eafbf009a 66 Timer all_evts;
gmehmet 1:f60eafbf009a 67 };
gmehmet 1:f60eafbf009a 68
gmehmet 1:f60eafbf009a 69
gmehmet 1:f60eafbf009a 70 #endif
gmehmet 1:f60eafbf009a 71 #endif //ENABLE_EVENTSTATS