From: adrian <> Date: Mon, 25 Sep 2006 21:04:06 +0000 (+0000) Subject: Add in more profiling points to identify CPU usage X-Git-Tag: SQUID_3_0_PRE5~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=559da9369e9ab602af11d56b40b1955793d269ca;p=thirdparty%2Fsquid.git Add in more profiling points to identify CPU usage --- diff --git a/include/profiling.h b/include/profiling.h index 7b9bc21ff2..81de4bc4bb 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -135,6 +135,13 @@ typedef enum { XPROF_MemBuf_grow, XPROF_InvokeHandlers, XPROF_HttpMsg_httpMsgParseStep, + XPROF_EventDispatcher_dispatch, + XPROF_SignalDispatcher_dispatch, + XPROF_Temp1, + XPROF_Temp2, + XPROF_Temp3, + XPROF_clientSocketRecipient, + XPROF_httpStart, XPROF_LAST } xprof_type; diff --git a/src/client_side.cc b/src/client_side.cc index 7fdfc3d255..fa403dbd3e 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.735 2006/09/20 06:29:10 adrian Exp $ + * $Id: client_side.cc,v 1.736 2006/09/25 15:04:06 adrian Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1256,6 +1256,7 @@ clientSocketRecipient(clientStreamNode * node, ClientHttpRequest * http, int fd; /* Test preconditions */ assert(node != NULL); + PROF_start(clientSocketRecipient); /* TODO: handle this rather than asserting * - it should only ever happen if we cause an abort and * the callback chain loops back to here, so we can simply return. @@ -1271,11 +1272,13 @@ clientSocketRecipient(clientStreamNode * node, ClientHttpRequest * http, if (context != http->getConn()->getCurrentContext()) { context->deferRecipientForLater(node, rep, recievedData); + PROF_stop(clientSocketRecipient); return; } if (responseFinishedOrFailed(rep, recievedData)) { context->writeComplete(fd, NULL, 0, COMM_OK); + PROF_stop(clientSocketRecipient); return; } @@ -1285,6 +1288,7 @@ clientSocketRecipient(clientStreamNode * node, ClientHttpRequest * http, http->al.reply = HTTPMSGLOCK(rep); context->sendStartOfMessage(rep, recievedData); } + PROF_stop(clientSocketRecipient); } /* Called when a downstream node is no longer interested in diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 7d367f9cad..d928b940c1 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.112 2006/08/25 15:22:34 serassio Exp $ + * $Id: client_side_reply.cc,v 1.113 2006/09/25 15:04:06 adrian Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1397,8 +1397,9 @@ clientReplyContext::identifyStoreObject() if (r->flags.cachable || r->flags.internal) { lookingforstore = 5; StoreEntry::getPublicByRequest (this, r); - } else + } else { identifyFoundObject (NullStoreEntry::getInstance()); + } } void @@ -1525,6 +1526,7 @@ clientGetMoreData(clientStreamNode * aNode, ClientHttpRequest * http) assert (context); assert(context->http == http); + clientStreamNode *next = ( clientStreamNode *)aNode->node.next->data; if (!context->ourNode) @@ -1565,7 +1567,6 @@ void clientReplyContext::doGetMoreData() { /* We still have to do store logic processing - vary, cache hit etc */ - if (http->storeEntry() != NULL) { /* someone found the object in the cache for us */ StoreIOBuffer tempBuffer; @@ -1602,8 +1603,7 @@ clientReplyContext::doGetMoreData() tempBuffer.offset = reqofs; tempBuffer.length = getNextNode()->readBuffer.length; tempBuffer.data = getNextNode()->readBuffer.data; - storeClientCopy(sc, http->storeEntry(), - tempBuffer, CacheHit, this); + storeClientCopy(sc, http->storeEntry(), tempBuffer, CacheHit, this); } else { /* MISS CASE, http->logType is already set! */ processMiss(); @@ -2024,7 +2024,6 @@ clientReplyContext::sendMoreData (StoreIOBuffer result) sendStreamError(tempBuffer); return; } - fatal ("clientReplyContext::sendMoreData: Unreachable code reached \n"); } diff --git a/src/client_side_request.cc b/src/client_side_request.cc index fa39c302bb..3c184afd69 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.73 2006/09/20 22:26:24 hno Exp $ + * $Id: client_side_request.cc,v 1.74 2006/09/25 15:04:07 adrian Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -909,6 +909,7 @@ ClientHttpRequest::processRequest() void ClientHttpRequest::httpStart() { + PROF_start(httpStart); logType = LOG_TAG_NONE; debug(85, 4) ("ClientHttpRequest::httpStart: %s for '%s'\n", log_tags[logType], uri); @@ -917,6 +918,7 @@ ClientHttpRequest::httpStart() /* Use the Stream Luke */ clientStreamNode *node = (clientStreamNode *)client_stream.tail->data; clientStreamRead(node, this, node->readBuffer); + PROF_stop(httpStart); } bool diff --git a/src/comm.cc b/src/comm.cc index 90c567c551..308a078d3f 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.426 2006/09/23 07:16:07 adrian Exp $ + * $Id: comm.cc,v 1.427 2006/09/25 15:04:07 adrian Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -535,7 +535,6 @@ commHandleRead(int fd, void *data) assert(data == COMMIO_FD_READCB(fd)); assert(commio_has_callback(fd, IOCB_READ, ccb)); - /* Attempt a read */ statCounter.syscalls.sock.reads++; errno = 0; diff --git a/src/event.cc b/src/event.cc index dbcc890e17..6a9d7ff0e3 100644 --- a/src/event.cc +++ b/src/event.cc @@ -1,6 +1,6 @@ /* - * $Id: event.cc,v 1.44 2006/09/01 23:56:38 hno Exp $ + * $Id: event.cc,v 1.45 2006/09/25 15:04:07 adrian Exp $ * * DEBUG: section 41 Event Processing * AUTHOR: Henrik Nordstrom @@ -116,6 +116,7 @@ EventDispatcher::dispatch() { bool result = queue.size() != 0; + PROF_start(EventDispatcher_dispatch); for (Vector::iterator i = queue.begin(); i != queue.end(); ++i) { ev_entry * event = *i; EVH *callback; @@ -134,6 +135,7 @@ EventDispatcher::dispatch() } queue.clean(); + PROF_stop(EventDispatcher_dispatch); return result; } diff --git a/src/main.cc b/src/main.cc index c44c972431..8c7c6300cb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.436 2006/09/13 18:55:10 serassio Exp $ + * $Id: main.cc,v 1.437 2006/09/25 15:04:07 adrian Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -164,6 +164,7 @@ private: bool SignalDispatcher::dispatch() { + PROF_start(SignalDispatcher_dispatch); if (do_reconfigure) { mainReconfigure(); do_reconfigure = 0; @@ -189,6 +190,7 @@ SignalDispatcher::dispatch() bool result = events_dispatched; events_dispatched = false; + PROF_stop(SignalDispatcher_dispatch); return result; }