Esempio n. 1
3
static inline size_t get_backtrace(Frames &frame_buffer,
                                   size_t frames_to_remove) {
  void *frames[2048];
  int count = ::backtrace(&frames[0], sizeof(frames) / sizeof(void *));
  if (count > frames_to_remove)
    frame_buffer.assign(&frames[frames_to_remove], &frames[count]);
  else
    frame_buffer.assign(&frames[0], &frames[count]);
  while (frame_buffer.back() < (void *)1024)
    frame_buffer.pop_back();
  return frame_buffer.size();
}
void SslConnector::handle(AMQFrame& frame) {
    bool notifyWrite = false;
    {
    Mutex::ScopedLock l(lock);
    frames.push_back(frame);
    //only ask to write if this is the end of a frameset or if we
    //already have a buffers worth of data
    currentSize += frame.encodedSize();
    if (frame.getEof()) {
        lastEof = frames.size();
        notifyWrite = true;
    } else {
        notifyWrite = (currentSize >= maxFrameSize);
    }
    /*
      NOTE: Moving the following line into this mutex block
            is a workaround for BZ 570168, in which the test
            testConcurrentSenders causes a hang about 1.5%
            of the time.  ( To see the hang much more frequently
            leave this line out of the mutex block, and put a
            small usleep just before it.)

            TODO mgoulish - fix the underlying cause and then
                            move this call back outside the mutex.
    */
    if (notifyWrite && !closed) aio->notifyPendingWrite();
    }
}
Esempio n. 3
0
void backtrace_log(const char *format, ...) {
  const int log_fd = get_logging_fd();
  if (log_fd >= 0) {
    if (format && format[0]) {
      va_list args;
      va_start(args, format);
      log(format, args);
      va_end(args);
    }

    Frames frames;
    if (get_backtrace(frames, 2))
      ::backtrace_symbols_fd(frames.data(), frames.size(), log_fd);
  }
}
Esempio n. 4
0
void ChannelUpdateVisitor::_updateDrawTiles( const Compound* compound,
                                             const RenderContext& context )
{
    Frames frames;
    std::vector< co::ObjectVersion > frameIDs;
    const Frames& outputFrames = compound->getOutputFrames();
    for( FramesCIter i = outputFrames.begin(); i != outputFrames.end(); ++i)
    {
        Frame* frame = *i;

        if( !frame->hasData( _eye )) // TODO: filter: buffers, vp, eye
            continue;

        frames.push_back( frame );
        frameIDs.push_back( co::ObjectVersion( frame ));
    }

    const Channel* destChannel = compound->getInheritChannel();
    const TileQueues& inputQueues = compound->getInputTileQueues();
    for( TileQueuesCIter i = inputQueues.begin(); i != inputQueues.end(); ++i )
    {
        const TileQueue* inputQueue = *i;
        const TileQueue* outputQueue = inputQueue->getOutputQueue( context.eye);
        const UUID& id = outputQueue->getQueueMasterID( context.eye );
        LBASSERT( id != UUID::ZERO );

        ChannelFrameTilesPacket tilesPacket;
        tilesPacket.isLocal = (_channel == destChannel);
        tilesPacket.context = context;
        tilesPacket.tasks = compound->getInheritTasks() &
                            ( eq::fabric::TASK_CLEAR | eq::fabric::TASK_DRAW |
                              eq::fabric::TASK_READBACK );

        tilesPacket.queueVersion.identifier = id;
        tilesPacket.queueVersion.version = co::VERSION_FIRST; // eile: ???
        tilesPacket.nFrames = uint32_t( frames.size( ));
        _channel->send< co::ObjectVersion >( tilesPacket, frameIDs );

        _updated = true;
        LBLOG( LOG_TASKS ) << "TASK tiles " << _channel->getName() <<  " "
                           << &tilesPacket << std::endl;
    }
}
Esempio n. 5
0
void backtrace_error(const char *format, ...) {
  const int pid = get_interposed_pid();
  if (pid >= 0) {
    const int log_fd = get_logging_fd();
    if (log_fd >= 0) {
      log("\nerror: %s (pid=%i): ", get_process_fullpath(), pid);

      if (format && format[0]) {
        va_list args;
        va_start(args, format);
        log(format, args);
        va_end(args);
      }

      Frames frames;
      if (get_backtrace(frames, 2))
        ::backtrace_symbols_fd(frames.data(), frames.size(), log_fd);
    }
  }
}
Esempio n. 6
0
 size_t size() { return frames.size(); }