Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 #ifndef _TimeTrace_h_
00033 #define _TimeTrace_h_
00034 
00035 
00036 
00037 #define TIME_DIST_BUCKETS               500
00038 #define TIME_DIST_BUCKETS_SIZE          TIME_DIST_BUCKETS+1
00039 
00040 #ifdef ENABLE_TIME_TRACE
00041 extern int cdb_callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00042 extern int cdb_cache_callbacks;
00043 
00044 extern int callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00045 extern int cache_callbacks;
00046 
00047 extern int rmt_callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00048 extern int rmt_cache_callbacks;
00049 
00050 extern int lkrmt_callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00051 extern int lkrmt_cache_callbacks;
00052 
00053 extern int cntlck_acquire_time_dist[TIME_DIST_BUCKETS_SIZE];
00054 extern int cntlck_acquire_events;
00055 
00056 extern int immediate_events_time_dist[TIME_DIST_BUCKETS_SIZE];
00057 extern int cnt_immediate_events;
00058 
00059 extern int inmsg_time_dist[TIME_DIST_BUCKETS_SIZE];
00060 extern int inmsg_events;
00061 
00062 extern int open_delay_time_dist[TIME_DIST_BUCKETS_SIZE];
00063 extern int open_delay_events;
00064 
00065 extern int cluster_send_time_dist[TIME_DIST_BUCKETS_SIZE];
00066 extern int cluster_send_events;
00067 #endif // ENABLE_TIME_TRACE
00068 
00069 #ifdef ENABLE_TIME_TRACE
00070 #define LOG_EVENT_TIME(_start_time, _time_dist, _time_cnt) do { \
00071   ink_hrtime now = ink_get_hrtime(); \
00072   unsigned int bucket = (now - _start_time) / HRTIME_MSECONDS(10); \
00073   if (bucket > TIME_DIST_BUCKETS) \
00074     bucket = TIME_DIST_BUCKETS; \
00075   ink_atomic_increment(&_time_dist[bucket], 1); \
00076   ink_atomic_increment(&_time_cnt, 1); \
00077 } while(0)
00078 
00079 #else // !ENABLE_TIME_TRACE
00080 #define LOG_EVENT_TIME(_start_time, _time_dist, _time_cnt)
00081 #endif // !ENABLE_TIME_TRACE
00082 
00083 #endif // _TimeTrace_h_
00084 
00085