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 #ifndef _P_TimeTrace_h_
00031 #define _P_TimeTrace_h_
00032
00033
00034
00035 #define TIME_DIST_BUCKETS 500
00036 #define TIME_DIST_BUCKETS_SIZE TIME_DIST_BUCKETS+1
00037
00038 #ifdef ENABLE_TIME_TRACE
00039 extern int cdb_callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00040 extern int cdb_cache_callbacks;
00041
00042 extern int callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00043 extern int cache_callbacks;
00044
00045 extern int rmt_callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00046 extern int rmt_cache_callbacks;
00047
00048 extern int lkrmt_callback_time_dist[TIME_DIST_BUCKETS_SIZE];
00049 extern int lkrmt_cache_callbacks;
00050
00051 extern int cntlck_acquire_time_dist[TIME_DIST_BUCKETS_SIZE];
00052 extern int cntlck_acquire_events;
00053
00054 extern int immediate_events_time_dist[TIME_DIST_BUCKETS_SIZE];
00055 extern int cnt_immediate_events;
00056
00057 extern int inmsg_time_dist[TIME_DIST_BUCKETS_SIZE];
00058 extern int inmsg_events;
00059
00060 extern int open_delay_time_dist[TIME_DIST_BUCKETS_SIZE];
00061 extern int open_delay_events;
00062
00063 extern int cluster_send_time_dist[TIME_DIST_BUCKETS_SIZE];
00064 extern int cluster_send_events;
00065 #endif // ENABLE_TIME_TRACE
00066
00067 #ifdef ENABLE_TIME_TRACE
00068 #define LOG_EVENT_TIME(_start_time, _time_dist, _time_cnt) do { \
00069 ink_hrtime now = ink_get_hrtime(); \
00070 unsigned int bucket = (now - _start_time) / HRTIME_MSECONDS(10); \
00071 if (bucket > TIME_DIST_BUCKETS) \
00072 bucket = TIME_DIST_BUCKETS; \
00073 ink_atomic_increment(&_time_dist[bucket], 1); \
00074 ink_atomic_increment(&_time_cnt, 1); \
00075 } while(0)
00076
00077 #else // !ENABLE_TIME_TRACE
00078 #define LOG_EVENT_TIME(_start_time, _time_dist, _time_cnt)
00079 #endif // !ENABLE_TIME_TRACE
00080
00081 #endif // _TimeTrace_h_
00082
00083