00001 /* 00002 * tictoc.hpp 00003 * 00004 * Created on: May 29, 2009 00005 * Author: abachrac 00006 */ 00007 00008 #ifndef __fovis_tictoch_hpp__ 00009 #define __fovis_tictoch_hpp__ 00010 00011 #include <inttypes.h> 00012 #include <vector> 00013 #include <string> 00014 00029 namespace fovis 00030 { 00031 00032 #define FOVIS_TICTOC_ENV "FOVIS_TICTOC" 00033 00037 struct tictoc_t 00038 { 00039 int64_t t; 00040 int64_t totalT; 00041 int64_t ema; 00042 int64_t min; 00043 int64_t max; 00044 int numCalls; 00045 char flag; 00046 std::string description; 00047 }; 00048 00054 int64_t 00055 tictoc(const char *description); 00056 00063 int64_t 00064 tictoc_full(const char *description, double ema_alpha, int64_t * ema); 00065 00071 typedef enum 00072 { 00073 TICTOC_AVG, 00074 TICTOC_TOTAL, 00075 TICTOC_MIN, 00076 TICTOC_MAX, 00077 TICTOC_EMA, 00078 TICTOC_ALPHABETICAL 00079 } tictoc_sort_type_t; 00080 00086 void 00087 tictoc_print_stats(tictoc_sort_type_t sortType); 00088 00092 void 00093 tictoc_get_stats(std::vector<tictoc_t> *stats); 00094 00099 } 00100 00101 #endif