当前位置: 首页>>代码示例>>C++>>正文


C++ StackTrace::hexEncode方法代码示例

本文整理汇总了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;
}
开发者ID:Neomeng,项目名称:hiphop-php,代码行数:32,代码来源:backtrace.cpp

示例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);
  }
}
开发者ID:GitOrganization,项目名称:hiphop-php,代码行数:12,代码来源:lock.cpp

示例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);
        }
      }
    }
  }
}
开发者ID:MarkTseng,项目名称:hiphop-php,代码行数:21,代码来源:simple_counter.cpp

示例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);
  }
}
开发者ID:ArPharazon,项目名称:hiphop-php,代码行数:24,代码来源:lock.cpp


注:本文中的StackTrace::hexEncode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。