Пример #1
0
void HPHP::ZendTraceCollector::leaveFunction(const ZendFunctionInfo& zfi)
{
  (void) zfi;
  if ( isCollecting() ) {
    --m_frame;
  }
}
Пример #2
0
void HPHP::ZendTraceCollector::enterFunction(const ZendFunctionInfo& zfi)
{
  if ( isCollecting() ) {
    ++m_frame;
    ZendFrame frame(zfi, m_frame);
    m_frames.push_back( frame );
    if ( !m_timesCalled.count(zfi.m_name) ) {
      m_timesCalled[zfi.m_name] = 0;
    }
    m_timesCalled[zfi.m_name]++;
  }
}
Пример #3
0
void XDebugProfiler::beginFrame(const char *symbol) {
  assert(isNeeded());

  // Check the stack depth, abort if we've reached the limit
  m_depth++;
  if (m_maxDepth != 0 && m_depth >= m_maxDepth) {
    raise_error("Maximum function nesting level of '%lu' reached, aborting!",
                m_maxDepth);
  }

  // Record the frame if we are collecting
  if (isCollecting()) {
    recordFrame(nullptr);
  }
}
Пример #4
0
void XDebugProfiler::endFrame(const TypedValue* retVal, const char* /*symbol*/,
                              bool /*endMain*/ /* = false */) {
  assert(isNeeded());
  m_depth--;

  if (isCollecting()) {
    // If tracing or profiling are enabled, we need to store end frames as well.
    // Otherwise we can just overwrite the most recent begin frame
    if (m_tracingEnabled || m_profilingEnabled) {
      recordFrame(retVal);
    } else {
      m_nextFrameIdx--;
    }
  }
}
Пример #5
0
void gazeEstimation::setRealDistances(int realLeft, int realRight, cv::Rect face)
{
    //Using face coords!
    double center = (double)face.width/2 - 0.5;  //0.5 is crucial to correctly get center coords.
    std::cout<<"Center is "<< center<<std::endl;

    //Get real left distance pupil/center
    realLeftToC = (double)realLeft - center;
    if(realLeftToC < 0) realLeftToC = -realLeftToC;
    std::cout<<"RealLeftToC = " <<realLeftToC<<std::endl;

    //Get real right distance pupil/center
    realRightToC = (double)realRight - center;
    if(realRightToC < 0) realRightToC = -realRightToC;
    std::cout<<"RealRightToC = " <<realRightToC<<std::endl;

    //Get both percentages with respect to face width
    realLeftToC = realLeftToC/face.width;
    realRightToC = realRightToC/face.width;
//    std::cout<<"RealLeftToC % = " <<realLeftToC<<std::endl;
//    std::cout<<"RealRightToC % = " <<realRightToC<<std::endl;

    assert(realLeftToC < 1 && realRightToC < 1);

    if(isCollecting())
    {
        //Update LEFT Distances
        if(realLeftToC < minLeftDist)
        {
            minLeftDist = realLeftToC;
        }
        if(realLeftToC > maxLeftDist)
        {
            maxLeftDist = realLeftToC;
        }

        //Update RIGHT Distances
        if(realRightToC < minRightDist)
        {
            minRightDist = realRightToC;
        }
        if(realRightToC > maxRightDist)
        {
            maxRightDist = realRightToC;
        }
    }
}
Пример #6
0
void HPHP::ZendTraceCollector::onFatalError(const std::string& errorString)
{
  if ( isCollecting() ) {
    // Locate the last item on the frames
    if ( !m_frames.empty() ) {
      ZendFrame& fr = *m_frames.rbegin();
      
      // add exception frame
      ZendFunctionInfo zfi;
      zfi.m_name = "***ERROR*** : " + errorString;
      zfi.m_linenumber = g_vmContext->getLastErrorLine();
      zfi.m_filename   = g_vmContext->getLastErrorPath().data();
      ZendFrame frame(zfi, fr.m_level);
      m_frames.push_back( frame );
    }
  }
}
Пример #7
0
void HPHP::ZendTraceCollector::dump(std::ostream& os)
{
  if ( isCollecting() ) {
    //-----------------------------------
    // Print global information
    //-----------------------------------
    os << ">>GLOBAL\n";
    if ( g_vmContext->getTransport() ) {
      Transport* transport = g_vmContext->getTransport();
      os << "URL|" << transport->getUrl() << "\n";
      os << "SERVER|" << transport->getServerAddr() << ":" << transport->getServerPort() << "\n";
    }
    os << "<<GLOBAL\n";
    
    //-----------------------------------
    // Print callstack
    //-----------------------------------
    os << ">>CALLSTACK\n";
    FrameList_t::const_iterator iter = m_frames.begin();
    
    for(; iter != m_frames.end(); ++iter ) {
      os << std::setw(5) << iter->m_level << std::setw(0) << "|";
      os << iter->m_func.m_name << iter->m_func.m_args << "|" << iter->m_func.m_filename << "|" << iter->m_func.m_linenumber <<  "\n";
    }
    os << "<<CALLSTACK\n";
    
    //-----------------------------------
    // Print call statistics
    //-----------------------------------
    os << ">>CALLS\n";
    MapTimes_t::iterator iterCalls = m_timesCalled.begin();
    for(; iterCalls != m_timesCalled.end(); ++iterCalls ) {
      os << iterCalls->first << "|" << iterCalls->second << "\n";
    }
    os << "<<CALLS\n";
  }
}