7
/* forward decls (C++ only) */
13
#ifdef USE_XPROF_STATS
15
#if !defined(_SQUID_SOLARIS_)
16
typedef int64_t hrtime_t;
21
#if defined(__i386) || defined(__i386__)
22
static inline hrtime_t
27
asm volatile ("rdtsc":"=A" (regs));
29
/* We need return value, we rely on CC to optimise out needless subf calls */
30
/* Note that "rdtsc" is relatively slow OP and stalls the CPU pipes, so use it wisely */
33
#elif defined(__alpha)
34
static inline hrtime_t
39
asm volatile ("rpcc %0" : "=r" (regs));
43
#elif defined(_M_IX86) && defined(_MSC_VER) /* x86 platform on Microsoft C Compiler ONLY */
44
static __inline hrtime_t
52
mov eax,DWORD PTR regs[0]
53
mov edx,DWORD PTR regs[4]
59
#warning Unsupported CPU. Define function get_tick(). Disabling USE_XPROF_STATS...
60
#undef USE_XPROF_STATS
63
#endif /* USE_XPROF_STATS - maybe disabled above */
65
#ifdef USE_XPROF_STATS
68
XPROF_PROF_UNACCOUNTED,
83
XPROF_memPoolChunkNew,
87
XPROF_aclMatchAclList,
90
XPROF_comm_connect_addr,
93
XPROF_comm_udp_sendto,
94
XPROF_commHandleWrite,
95
XPROF_comm_check_incoming,
96
XPROF_comm_poll_prep_pfds,
97
XPROF_comm_poll_normal,
98
XPROF_comm_handle_ready_fd,
99
XPROF_comm_read_handler,
100
XPROF_comm_write_handler,
102
XPROF_storeMaintainSwapSpace,
104
XPROF_diskHandleWrite,
105
XPROF_diskHandleRead,
111
XPROF_esiExpressionEval,
115
XPROF_storeClient_kickReads,
117
XPROF_storeDirCallback,
118
XPROF_comm_calliocallback,
119
XPROF_CommReadCallbackData_callCallback,
120
XPROF_CommAcceptCallbackData_callCallback,
121
XPROF_CommWriteCallbackData_callCallback,
122
XPROF_CommFillCallbackData_callCallback,
123
XPROF_HttpStateData_readReply,
124
XPROF_HttpStateData_processReplyBody,
125
XPROF_StoreEntry_write,
126
XPROF_storeGetMemSpace,
127
XPROF_MemObject_write,
128
XPROF_storeWriteComplete,
131
XPROF_parseHttpRequest,
132
XPROF_HttpStateData_processReplyHeader,
133
XPROF_MemBuf_consume,
136
XPROF_InvokeHandlers,
137
XPROF_HttpMsg_httpMsgParseStep,
138
XPROF_EventDispatcher_dispatch,
139
XPROF_SignalDispatcher_dispatch,
143
XPROF_clientSocketRecipient,
145
XPROF_HttpParserParseReqLine,
146
XPROF_httpRequestFree,
147
XPROF_HttpHeaderParse,
148
XPROF_HttpHeaderClean,
151
XPROF_StringLimitInit,
155
XPROF_HttpHeader_findEntry,
156
XPROF_HttpHeader_getCc,
157
XPROF_HttpHeader_getRange,
161
#define XP_NOBEST (hrtime_t)-1
163
typedef struct _xprof_stats_node xprof_stats_node;
165
typedef struct _xprof_stats_data xprof_stats_data;
167
struct _xprof_stats_data
178
struct _xprof_stats_node
181
xprof_stats_data accu;
182
xprof_stats_data hist;
185
typedef xprof_stats_node TimersArray[1];
188
SQUIDCEXTERN TimersArray *xprof_Timers;
189
SQUIDCEXTERN int xprof_nesting;
191
/* Exported functions */
192
SQUIDCEXTERN void xprof_start(xprof_type type, const char *timer);
193
SQUIDCEXTERN void xprof_stop(xprof_type type, const char *timer);
194
SQUIDCEXTERN void xprof_event(void *data);
196
extern void xprofRegisterWithCacheManager(CacheManager & manager);
199
#define PROF_start(type) xprof_start(XPROF_##type, #type)
200
#define PROF_stop(type) xprof_stop(XPROF_##type, #type)
202
#else /* USE_XPROF_STATS */
204
#define PROF_start(ARGS) ((void)0)
205
#define PROF_stop(ARGS) ((void)0)
207
#endif /* USE_XPROF_STATS */
209
#endif /* _PROFILING_H_ */