• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/home/jgoppert/Projects/ap/libraries/APM_PerfMon/APM_PerfMon.h

Go to the documentation of this file.
00001 #ifndef APM_PerfMon_h
00002 #define APM_PerfMon_h
00003 
00004 // macros to make integrating into code easier
00005 #define APM_PERFMON_REGISTER static int myFunc = APM_PerfMon::recordFunctionName(__func__); APM_PerfMon perfMon(myFunc);
00006 #define APM_PERFMON_REGISTER_NAME(functionName) static int myFunc = APM_PerfMon::recordFunctionName(functionName); APM_PerfMon perfMon(myFunc);
00007 
00008 #define PERFMON_MAX_FUNCTIONS 50
00009 #define PERFMON_FUNCTION_NAME_LENGTH 20
00010 
00011 __extension__ typedef int __guard __attribute__((mode (__DI__))); 
00012 
00013 extern "C" int __cxa_guard_acquire(__guard *); 
00014 extern "C" void __cxa_guard_release (__guard *); 
00015 extern "C" void __cxa_guard_abort (__guard *);
00016 
00017 #include "HardwareSerial.h"
00018 
00019 class APM_PerfMon
00020 {
00021     public:
00022         // static variables
00023         static int nextFuncNum;
00024                 static char functionNames[PERFMON_MAX_FUNCTIONS][PERFMON_FUNCTION_NAME_LENGTH];
00025         static unsigned long time[PERFMON_MAX_FUNCTIONS];
00026                 static unsigned long numCalls[PERFMON_MAX_FUNCTIONS];
00027                 static unsigned long allStartTime;
00028                 static unsigned long allEndTime;
00029                 static APM_PerfMon* lastCreated;
00030 
00031                 // static methods
00032         static int recordFunctionName(const char funcName[]);
00033         static void DisplayResults(HardwareSerial* aSerial);            
00034                 static void ClearAll();
00035                 static int strLen(char* str);
00036                 
00037         // normal variables
00038         int _funcNum;
00039         unsigned long _startTime;
00040                 APM_PerfMon* _parent;
00041 
00042                 // normal methods
00043                 APM_PerfMon(int funcNum);  // Constructor - records function start time
00044                 ~APM_PerfMon();  // Destructor - records function end time
00045                 void stop();  // stops recording time spent in this function - meant to be called by a child.
00046                 void start();  // restarts recording time spent in this function
00047 };
00048 
00049 #endif  // APM_PerfMon_h

Generated for ArduPilot Libraries by doxygen