version 1.9, 2015/01/01 16:04:51
|
version 1.10, 2015/01/04 22:52:35
|
|
|
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
// General class to process various objects that are made up of Pegaus |
|
// Strings back to the String and more directly to the const char* ... |
|
// used for display. This can be used for |
|
// String, CIMName, CIMNamespaceName, Exception, CIMDateTime, CIMObjectPath |
|
// The same general class exists in several places in OpenPegasus. |
|
// TODO: make this a general part of Pegasus so it is not duplicated in |
|
// many different files. |
|
class Str |
|
{ |
|
public: |
|
Str(const String& s) : _cstr(s.getCString()) { } |
|
Str(const CIMName& n) : _cstr(n.getString().getCString()) { } |
|
Str(const CIMNamespaceName& n) : _cstr(n.getString().getCString()) { } |
|
Str(const Exception& e) : _cstr(e.getMessage().getCString()) { } |
|
Str(const CIMDateTime& x) : _cstr(x.toString().getCString()) { } |
|
Str(const CIMObjectPath& x) : _cstr(x.toString().getCString()) { } |
|
const char* operator*() const { return (const char*)_cstr; } |
|
operator const char*() const { return (const char*)_cstr; } |
|
private: |
|
CString _cstr; |
|
}; |
|
|
// defines conversion between sec and usec | // defines conversion between sec and usec |
#define PEG_MICROSEC 1000000 | #define PEG_MICROSEC 1000000 |
| |
|
|
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL3, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL3, |
"Create EnumerationContext ContextId=%s operationTimeoutSec %u" | "Create EnumerationContext ContextId=%s operationTimeoutSec %u" |
" responseCacheDataType %u StartTime %lu", | " responseCacheDataType %u StartTime %lu", |
(const char *)getContextId().getCString(), |
*Str(getContextId()), |
_operationTimeoutSec, | _operationTimeoutSec, |
_responseCache.getResponseDataContent(), | _responseCache.getResponseDataContent(), |
(unsigned long int)_startTimeUsec)); | (unsigned long int)_startTimeUsec)); |
|
|
"StartTimer, ContextId=%s, This timeoutTime(sec)=%llu" | "StartTimer, ContextId=%s, This timeoutTime(sec)=%llu" |
" OperationTimeout=%u sec," | " OperationTimeout=%u sec," |
" next timeout in %ld sec,", | " next timeout in %ld sec,", |
(const char*)getContextId().getCString(), |
*Str(getContextId()), |
(timeoutUsec / PEG_MICROSEC), | (timeoutUsec / PEG_MICROSEC), |
_operationTimeoutSec, | _operationTimeoutSec, |
(long signed int)(_operationTimerUsec - currentTime)/PEG_MICROSEC )); | (long signed int)(_operationTimerUsec - currentTime)/PEG_MICROSEC )); |
|
|
"StopTimer ContextId=%s," | "StopTimer ContextId=%s," |
" OperationTimeout=%u sec," | " OperationTimeout=%u sec," |
" (timerTime - curtime)=%ld sec,", | " (timerTime - curtime)=%ld sec,", |
(const char*)getContextId().getCString(), |
*Str(getContextId()), _operationTimeoutSec, |
_operationTimeoutSec, |
|
(long signed int)(_operationTimerUsec - | (long signed int)(_operationTimerUsec - |
System::getCurrentTimeUsec())/PEG_MICROSEC )); | System::getCurrentTimeUsec())/PEG_MICROSEC )); |
#endif | #endif |
|
|
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, |
"isTimedOut Timer. ContextId=%s timer(sec)=%lu" | "isTimedOut Timer. ContextId=%s timer(sec)=%lu" |
" current(sec)=%lu time to timeout(usec)=%ld isTimedOut=%s", | " current(sec)=%lu time to timeout(usec)=%ld isTimedOut=%s", |
(const char*)_contextId.getCString(), |
*Str(getContextId()), |
(long unsigned int)(_operationTimerUsec / PEG_MICROSEC), | (long unsigned int)(_operationTimerUsec / PEG_MICROSEC), |
(long unsigned int)(currentTime / PEG_MICROSEC), | (long unsigned int)(currentTime / PEG_MICROSEC), |
(long signed int)((_operationTimerUsec - currentTime)), | (long signed int)((_operationTimerUsec - currentTime)), |
|
|
"maxWaitTimeUsec=%llu " | "maxWaitTimeUsec=%llu " |
"RequestedResponseObjectCount=%u " | "RequestedResponseObjectCount=%u " |
"totalZeroLenObjectResponseCounter=%u", | "totalZeroLenObjectResponseCounter=%u", |
(const char *)_contextId.getCString(), |
*Str(getContextId()), |
_operationTimeoutSec, | _operationTimeoutSec, |
(long unsigned int)_operationTimerUsec, | (long unsigned int)_operationTimerUsec, |
boolToString(_continueOnError), | boolToString(_continueOnError), |
|
|
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, |
"putCache, ContextId=%s isComplete=%s ResponseDataType=%u " | "putCache, ContextId=%s isComplete=%s ResponseDataType=%u " |
" cacheSize=%u putSize=%u clientClosed=%s", | " cacheSize=%u putSize=%u clientClosed=%s", |
(const char*)getContextId().getCString(), |
*Str(getContextId()), |
boolToString(providersComplete), | boolToString(providersComplete), |
_responseCache.getResponseDataContent(), | _responseCache.getResponseDataContent(), |
_responseCache.size(), from.size(), | _responseCache.size(), from.size(), |
|
|
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE | #ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE |
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, |
"waitCacheSize ContextId=%s Wait=%lu usec", | "waitCacheSize ContextId=%s Wait=%lu usec", |
(const char *)_contextId.getCString(), |
*Str(getContextId()), (unsigned long int)interval )); |
(unsigned long int)interval )); |
|
#endif | #endif |
| |
_totalWaitTimeUsec += interval; | _totalWaitTimeUsec += interval; |
|
|
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE | #ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE |
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, |
"testCacheForResponse returns %s for ContextId=%s", | "testCacheForResponse returns %s for ContextId=%s", |
boolToString(rtn), (const char*)getContextId().getCString() )); |
boolToString(rtn), *Str(getContextId()) )); |
#endif | #endif |
return rtn; | return rtn; |
} | } |
|
|
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE | #ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE |
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, |
"EnumerationContext::getCache ContextId=%s moveObjects expected=%u" | "EnumerationContext::getCache ContextId=%s moveObjects expected=%u" |
" actual=%u", (const char *)getContextId().getCString(), |
" actual=%u", *Str(getContextId()), count, rtnData.size())); |
count, rtnData.size())); |
|
#endif | #endif |
| |
// Signal the ProviderLimitCondition that the cache size may | // Signal the ProviderLimitCondition that the cache size may |
|
|
| |
PEGASUS_DEBUG_ASSERT(valid()); | PEGASUS_DEBUG_ASSERT(valid()); |
| |
|
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, |
|
"EnumerationContext::signalProviderWait Condition ContextId=%s" |
|
" cacheSize=%u", *Str(getContextId()), responseCacheSize() )); |
|
|
AutoMutex autoMut(_providerWaitConditionMutex); | AutoMutex autoMut(_providerWaitConditionMutex); |
| |
_providerWaitCondition.signal(); | _providerWaitCondition.signal(); |
|
|
| |
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE | #ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE |
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL3, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL3, |
"setClientClosed. ContextId=%s ", |
"setClientClosed. ContextId=%s ", *Str(getContextId()) )); |
(const char*)getContextId().getCString() )); |
|
#endif | #endif |
| |
// Clear any existing responses out of the cache. The will never | // Clear any existing responses out of the cache. The will never |
|
|
#ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE | #ifdef ENUMERATION_CONTEXT_DIAGNOSTIC_TRACE |
PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, | PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4, |
"setProcessingState. ContextId=%s nextProcessingStat=%s", | "setProcessingState. ContextId=%s nextProcessingStat=%s", |
(const char*)getContextId().getCString(), |
*Str(getContextId()), (state? "active" : "inactive") )); |
(state? "active" : "inactive") )); |
|
#endif | #endif |
| |
_processing = state; | _processing = state; |