| 65 | } // end anonymous namespace |
| 66 | |
| 67 | size_t |
| 68 | LogBufferManager::preproc_buffers(LogBufferSink *sink) |
| 69 | { |
| 70 | SList(LogBuffer, write_link) q(write_list.popall()), new_q; |
| 71 | LogBuffer *b = nullptr; |
| 72 | while ((b = q.pop())) { |
| 73 | if (b->m_references || b->m_state.s.num_writers) { |
| 74 | // Still has outstanding references. |
| 75 | write_list.push(b); |
| 76 | } else if (_num_flush_buffers > FLUSH_ARRAY_SIZE) { |
| 77 | ink_atomic_increment(&_num_flush_buffers, -1); |
| 78 | Warning("Dropping log buffer, can't keep up."); |
| 79 | Metrics::Counter::increment(log_rsb.bytes_lost_before_preproc, b->header()->byte_count); |
| 80 | delete b; |
| 81 | } else { |
| 82 | new_q.push(b); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | int prepared = 0; |
| 87 | while ((b = new_q.pop())) { |
| 88 | b->update_header_data(); |
| 89 | sink->preproc_and_try_delete(b); |
| 90 | ink_atomic_increment(&_num_flush_buffers, -1); |
| 91 | prepared++; |
| 92 | } |
| 93 | |
| 94 | Dbg(dbg_ctl_log_logbuffer, "prepared %d buffers", prepared); |
| 95 | return prepared; |
| 96 | } |
| 97 | |
| 98 | /*------------------------------------------------------------------------- |
| 99 | LogObject |
no test coverage detected