]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add in more profiling points to identify CPU usage
authoradrian <>
Mon, 25 Sep 2006 21:04:06 +0000 (21:04 +0000)
committeradrian <>
Mon, 25 Sep 2006 21:04:06 +0000 (21:04 +0000)
include/profiling.h
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/comm.cc
src/event.cc
src/main.cc

index 7b9bc21ff278502e82c8d383bcaea20a01956b73..81de4bc4bb5d965b74aa1828105e677a119b22e0 100644 (file)
@@ -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;
 
index 7fdfc3d25581164ee256d020cd52a90377a59cd9..fa403dbd3edaf9113dbbb551dbc566ae3844384d 100644 (file)
@@ -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
index 7d367f9cadf4b984b5eaac03c943fbf9a6185834..d928b940c1030f9c61f576cc635cc1a04302525a 100644 (file)
@@ -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");
 }
 
index fa39c302bbe6fc0e47e24f04cb4c87c316ed00e4..3c184afd69efd0b1e53334a31b07656e3b56c166 100644 (file)
@@ -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
index 90c567c55115bdd6e79334197ef076b024b5f4ce..308a078d3f796dc1183e9d0b299ce2149bd9d666 100644 (file)
@@ -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;
index dbcc890e17021b174e61f64edeb71c14d2571e2f..6a9d7ff0e384021c06c0a8290e5bd69d16a14ae4 100644 (file)
@@ -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<ev_entry *>::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;
 }
 
index c44c97243124ea8b15cb8265ba1d6c71bbf5a9a9..8c7c6300cb9388ce370c44d9dada9d3775b2aa8e 100644 (file)
@@ -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;
 }