本文整理汇总了C++中StackTrace::hexEncode方法的典型用法代码示例。如果您正苦于以下问题:C++ StackTrace::hexEncode方法的具体用法?C++ StackTrace::hexEncode怎么用?C++ StackTrace::hexEncode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StackTrace
的用法示例。
在下文中一共展示了StackTrace::hexEncode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stackTraceToBackTrace
Array stackTraceToBackTrace(const StackTrace& st) {
std::vector<void*> bt_pointers;
st.get(bt_pointers);
Array ret;
if (RuntimeOption::FullBacktrace) {
for (unsigned int i = 0; i < bt_pointers.size(); i++) {
StackTrace::FramePtr f = StackTrace::Translate(bt_pointers[i]);
if (RuntimeOption::TranslateSource) {
SourceInfo::TheSourceInfo.translate(f);
}
Array frame;
frame.set("file", String(f->filename));
frame.set("line", f->lineno);
frame.set("function", String(f->funcname));
frame.set("args", "");
frame.set("bt", (int64)bt_pointers[i]);
ret.append(frame);
}
} else {
for (unsigned int i = 0; i < bt_pointers.size(); i++) {
Array frame;
frame.set("file", "");
frame.set("line", 0LL);
frame.set("function", "");
frame.set("args", "");
frame.set("bt", (int64)bt_pointers[i]);
ret.append(frame);
}
ret.set("bts", String(st.hexEncode()));
}
return ret;
}
示例2:
LockProfiler::~LockProfiler() {
if (m_profiling) {
timespec unlockTime;
Timer::GetMonotonicTime(unlockTime);
time_t dsec = unlockTime.tv_sec - m_lockTime.tv_sec;
long dnsec = unlockTime.tv_nsec - m_lockTime.tv_nsec;
int64_t dusec = dsec * 1000000 + dnsec / 1000;
StackTrace st;
s_pfunc_profile(st.hexEncode(3, 9), dusec);
}
}
示例3: Count
void SimpleCounter::Count(const string &name) {
if (Enabled) {
int count = ++s_counter->m_counters[name];
if (SampleStackCount > 0) {
assert(StackTrace::Enabled);
vector<string> &stackVec = s_counter->m_stacks[name];
if ((int)stackVec.size() < SampleStackCount ||
f_rand(0, count - 1) < SampleStackCount) {
StackTrace st;
if ((int)stackVec.size() < SampleStackCount) {
// skip StackTrace methods and the Count() call.
stackVec.push_back(st.hexEncode(3, 3 + SampleStackDepth));
} else {
// skip StackTrace methods and the Count() call.
stackVec[f_rand(0, SampleStackCount - 1)] =
st.hexEncode(3, 3 + SampleStackDepth);
}
}
}
}
}
示例4: defined
LockProfiler::~LockProfiler() {
if (m_profiling) {
#if defined(__APPLE__)
timeval unlockTime;
unlockTime.tv_sec = 0;
unlockTime.tv_usec = 0;
gettimeofday(&unlockTime, NULL);
time_t dsec = unlockTime.tv_sec - m_lockTime.tv_sec;
long dnsec = unlockTime.tv_usec - m_lockTime.tv_usec;
int64 dusec = dsec * 1000000 + dnsec;
#else
timespec unlockTime;
unlockTime.tv_sec = 0;
unlockTime.tv_nsec = 0;
clock_gettime(CLOCK_MONOTONIC, &unlockTime);
time_t dsec = unlockTime.tv_sec - m_lockTime.tv_sec;
long dnsec = unlockTime.tv_nsec - m_lockTime.tv_nsec;
int64 dusec = dsec * 1000000 + dnsec / 1000;
#endif
StackTrace st;
s_pfunc_profile(st.hexEncode(3, 9), dusec);
}
}