Use InstanceId for async job and calls identification. Side-effect: removes inconsistent prefixes for job debugging: ecapxN, icapxN, asyncN are now all jobN, simplifying searching and processing debugging logs. === modified file 'src/adaptation/ecap/XactionRep.cc' --- src/adaptation/ecap/XactionRep.cc 2010-08-29 21:50:09 +0000 +++ src/adaptation/ecap/XactionRep.cc 2010-09-29 18:14:05 +0000 @@ -446,7 +446,7 @@ buf.append(" A.", 3); } - buf.Printf(" ecapx%d]", id); + buf.Printf(" %s%u]", id.Prefix, id.value); buf.terminate(); === modified file 'src/adaptation/icap/Xaction.cc' --- src/adaptation/icap/Xaction.cc 2010-09-13 00:19:25 +0000 +++ src/adaptation/icap/Xaction.cc 2010-09-29 18:14:27 +0000 @@ -538,7 +538,7 @@ buf.append("/", 1); fillDoneStatus(buf); - buf.Printf(" icapx%d]", id); + buf.Printf(" %s%u]", id.Prefix, id.value); buf.terminate(); === modified file 'src/base/AsyncCall.cc' --- src/base/AsyncCall.cc 2009-04-09 22:31:13 +0000 +++ src/base/AsyncCall.cc 2010-09-29 16:40:44 +0000 @@ -7,17 +7,17 @@ #include "base/AsyncCallQueue.h" #include "cbdata.h" -unsigned int AsyncCall::TheLastId = 0; +InstanceIdDefinitions(AsyncCall, "call"); /* AsyncCall */ AsyncCall::AsyncCall(int aDebugSection, int aDebugLevel, const char *aName): name(aName), debugSection(aDebugSection), - debugLevel(aDebugLevel), id(++TheLastId), theNext(0), isCanceled(NULL) + debugLevel(aDebugLevel), theNext(0), isCanceled(NULL) { debugs(debugSection, debugLevel, "The AsyncCall " << name << " constructed, this=" << this << - " [call" << id << ']'); + " [" << id << ']'); } AsyncCall::~AsyncCall() @@ -29,7 +29,7 @@ AsyncCall::make() { debugs(debugSection, debugLevel, HERE << "make call " << name << - " [call"<< id << ']'); + " [" << id << ']'); if (canFire()) { fire(); return; @@ -39,7 +39,7 @@ isCanceled = "unknown reason"; debugs(debugSection, debugLevel, HERE << "will not call " << name << - " [call"<< id << ']' << " because of " << isCanceled); + " [" << id << ']' << " because of " << isCanceled); } bool @@ -47,7 +47,7 @@ { if (isCanceled) debugs(debugSection, debugLevel, HERE << "will not call " << name << - " [call"<< id << ']' << " also because " << reason); + " [" << id << ']' << " also because " << reason); isCanceled = reason; return false; } @@ -73,7 +73,7 @@ ScheduleCall(const char *fileName, int fileLine, AsyncCall::Pointer &call) { debugs(call->debugSection, call->debugLevel, fileName << "(" << fileLine << - ") will call " << *call << " [call"<< call->id << ']' ); + ") will call " << *call << " [" << call->id << ']' ); AsyncCallQueue::Instance().schedule(call); return true; } === modified file 'src/base/AsyncCall.h' --- src/base/AsyncCall.h 2009-04-09 22:31:13 +0000 +++ src/base/AsyncCall.h 2010-09-29 16:13:21 +0000 @@ -6,6 +6,7 @@ #define SQUID_ASYNCCALL_H //#include "cbdata.h" +#include "base/InstanceId.h" #include "event.h" //#include "TextException.h" @@ -69,7 +70,7 @@ const char *const name; const int debugSection; const int debugLevel; - const unsigned int id; + const InstanceId id; protected: virtual bool canFire(); @@ -80,7 +81,6 @@ private: const char *isCanceled; // set to the cancelation reason by cancel() - static unsigned int TheLastId; }; inline === modified file 'src/base/AsyncJob.cc' --- src/base/AsyncJob.cc 2010-09-12 00:10:47 +0000 +++ src/base/AsyncJob.cc 2010-09-29 18:15:38 +0000 @@ -10,8 +10,7 @@ #include "cbdata.h" #include "MemBuf.h" - -unsigned int AsyncJob::TheLastId = 0; +InstanceIdDefinitions(AsyncJob, "job"); AsyncJob::Pointer AsyncJob::Start(AsyncJob *j) { @@ -20,16 +19,16 @@ return job; } -AsyncJob::AsyncJob(const char *aTypeName): typeName(aTypeName), inCall(NULL), id(++TheLastId) +AsyncJob::AsyncJob(const char *aTypeName): typeName(aTypeName), inCall(NULL) { debugs(93,5, "AsyncJob constructed, this=" << this << - " type=" << typeName << " [job" << id << ']'); + " type=" << typeName << " [" << id << ']'); } AsyncJob::~AsyncJob() { debugs(93,5, "AsyncJob destructed, this=" << this << - " type=" << typeName << " [job" << id << ']'); + " type=" << typeName << " [" << id << ']'); } void AsyncJob::start() @@ -156,7 +155,7 @@ buf.Printf("Stopped, reason:"); buf.Printf("%s",stopReason); } - buf.Printf(" job%d]", id); + buf.Printf(" %s%u]", id.Prefix, id.value); buf.terminate(); return buf.content(); === modified file 'src/base/AsyncJob.h' --- src/base/AsyncJob.h 2010-08-23 23:15:26 +0000 +++ src/base/AsyncJob.h 2010-09-29 16:57:30 +0000 @@ -6,6 +6,7 @@ #define SQUID_ASYNC_JOB_H #include "base/AsyncCall.h" +#include "base/InstanceId.h" template class CbcPointer; @@ -63,10 +64,7 @@ const char *stopReason; ///< reason for forcing done() to be true const char *typeName; ///< kid (leaf) class name, for debugging AsyncCall::Pointer inCall; ///< the asynchronous call being handled, if any - const unsigned int id; ///< unique ID across all strand jobs, unless wraps - -private: - static unsigned int TheLastId; ///< makes job IDs unique until it wraps + const InstanceId id; ///< job identifier }; #endif /* SQUID_ASYNC_JOB_H */