Line data Source code
1 : #include "fromhost_buffer.hpp" 2 : #include "log.hpp" 3 : #include <cstdint> 4 : #include <chrono> 5 : 6 10004 : void FromHostBuffer::encode_and_write(uint64_t elink, const uint8_t* source, size_t size, bool trickle) 7 : { 8 : // If trickle is true just start writing from the beginning of the buffer 9 10004 : uint64_t dest_offset = (trickle) ? 0 : dma_get_write_offset(); 10 10004 : LOG_DBG("Encoding msg for elink 0x%x at CMEM buffer offset 0x%lx", elink, dest_offset); 11 10004 : uint64_t new_dest_offset = m_encoder.encode_and_write_msg(elink, source, size, dest_offset); 12 10004 : dma_set_write_offset(new_dest_offset); 13 10004 : ++m_mon.msg_counter; 14 10004 : m_mon.bytes_counter += size; 15 10004 : } 16 : 17 : 18 21 : FromHostDmaStats FromHostBuffer::get_monitoring_data() 19 : { 20 21 : FromHostDmaStats stats = m_mon.get_increment(m_mon_prev); 21 21 : stats.dmaid = m_dmaid; 22 21 : stats.dma_free_MB = dma_get_free_MB(); 23 21 : return stats; 24 : }