本文整理汇总了C++中ACE_Stack_Trace类的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Stack_Trace类的具体用法?C++ ACE_Stack_Trace怎么用?C++ ACE_Stack_Trace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ACE_Stack_Trace类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Assert
void Assert(char const *file, int line, char const *function, char const *message)
{
ACE_Stack_Trace st;
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n",
file, line, function, message, st.c_str());
*((volatile int*)NULL) = 0;
}
示例2: va_start
void Log::outErrorST(const char * str, ...)
{
va_list ap;
va_start(ap, str);
char nnew_str[MAX_QUERY_LEN];
vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap);
va_end(ap);
ACE_Stack_Trace st;
outError("%s [Stacktrace: %s]", nnew_str, st.c_str());
}
示例3: ByteBuffer
ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos,
size_t size, size_t valueSize)
{
std::ostringstream ss;
ACE_Stack_Trace trace;
ss << "Attempted to " << (add ? "put" : "get") << " value with size: "
<< valueSize << " in ByteBuffer (pos: " << pos << " size: " << size
<< ")\n\n" << trace.c_str();
message().assign(ss.str());
}
示例4: SendPacket
/// Send a packet to the client
void WorldSession::SendPacket (WorldPacket const* packet)
{
if (!m_Socket)
return;
if (sWorld->debugOpcode != 0 && packet->GetOpcode() != sWorld->debugOpcode)
return;
if (packet->GetOpcode() == UNKNOWN_OPCODE)
{
sLog->outError("Sending unknown opcode - prevented. Trace:");
ACE_Stack_Trace trace;
sLog->outError("%s", trace.c_str());
return;
}
#ifdef ARKCORE_DEBUG
// Code for network use statistic
static uint64 sendPacketCount = 0;
static uint64 sendPacketBytes = 0;
static time_t firstTime = time(NULL);
static time_t lastTime = firstTime;// next 60 secs start time
static uint64 sendLastPacketCount = 0;
static uint64 sendLastPacketBytes = 0;
time_t cur_time = time(NULL);
if ((cur_time - lastTime) < 60)
{
sendPacketCount+=1;
sendPacketBytes+=packet->size();
sendLastPacketCount+=1;
sendLastPacketBytes+=packet->size();
}
else
{
uint64 minTime = uint64(cur_time - lastTime);
uint64 fullTime = uint64(lastTime - firstTime);
sLog->outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime));
sLog->outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime);
lastTime = cur_time;
sendLastPacketCount = 1;
sendLastPacketBytes = packet->wpos(); // wpos is real written size
}
#endif // !ARKCORE_DEBUG
if (m_Socket->SendPacket(*packet) == -1)
m_Socket->CloseSocket();
}
示例5: PrintPosError
void ByteBufferException::PrintPosError() const
{
char const* traceStr;
ACE_Stack_Trace trace;
traceStr = trace.c_str();
sLog.outError(
"Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: " SIZEFMTD ") "
"value with size: " SIZEFMTD "%s%s",
(add ? "put" : "get"), pos, size, esize,
traceStr ? "\n" : "", traceStr ? traceStr : "");
}
示例6: SendPacket
/// Send a packet to the client
void WorldSession::SendPacket(WorldPacket const *packet, bool nocheck)
{
if (!m_Socket)
return;
if (packet->GetOpcode() == UNKNOWN_OPCODE)
{
sLog->outError("Sending unknown opcode - prevented. Trace:");
ACE_Stack_Trace trace;
sLog->outError("%s", trace.c_str());
return;
}
#ifdef TRILLIUM_DEBUG
// Code for network use statistic
static uint64 sendPacketCount = 0;
static uint64 sendPacketBytes = 0;
static time_t firstTime = time(NULL);
static time_t lastTime = firstTime; // next 60 secs start time
static uint64 sendLastPacketCount = 0;
static uint64 sendLastPacketBytes = 0;
time_t cur_time = time(NULL);
if ((cur_time - lastTime) < 60)
{
sendPacketCount+=1;
sendPacketBytes+=packet->size();
sendLastPacketCount+=1;
sendLastPacketBytes+=packet->size();
}
else
{
uint64 minTime = uint64(cur_time - lastTime);
uint64 fullTime = uint64(lastTime - firstTime);
sLog->outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime));
sLog->outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime);
lastTime = cur_time;
sendLastPacketCount = 1;
sendLastPacketBytes = packet->wpos(); // wpos is real written size
}
#endif
// !TRILLIUM_DEBUG
sLog->outString("SESSION: Try to SEND opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
if (nocheck)
{
if (m_Socket->SendPacket (*packet) == -1)
m_Socket->CloseSocket ();
}
else
{
if (packet->GetOpcode() > NUM_OPCODE_HANDLERS)
return;
const OpcodeHandler* handler = opcodeTable[packet->GetOpcode()];
try
{
switch (handler->blockout)
{
case ROUTE_NULL:
return;
case ROUTE_ALWAYS:
{
if (m_Socket->SendPacket (*packet) == -1)
m_Socket->CloseSocket ();
break;
}
case ROUTE_NO_NODE:
{
if (!m_redirected)
{
if (m_Socket->SendPacket (*packet) == -1)
m_Socket->CloseSocket ();
}
}
}
}
catch(ByteBufferException &)
{
sLog->outString("ERROR BY PACKET");
}
}
}