2 #include "../XrdCephPosix.hh"
15 using myclock = std::chrono::steady_clock;
61 float read_speed{0}, write_speed{0};
62 if (m_stats_read_req.load() > 0) {
63 read_speed = m_stats_read_bytes.load() / m_stats_read_timer.load() * 1e-3;
65 if (m_stats_write_req.load() > 0) {
66 write_speed = m_stats_write_bytes.load() / m_stats_write_timer.load() * 1e-3;
68 BUFLOG(
"CephIOAdapterAIORaw::Summary fd:" << m_fd
69 <<
" nwrite:" << m_stats_write_req <<
" byteswritten:" << m_stats_write_bytes <<
" write_s:"
70 << m_stats_write_timer * 1e-3 <<
" writemax_s" << m_stats_write_longest * 1e-3
71 <<
" write_MBs:" << write_speed
72 <<
" nread:" << m_stats_read_req <<
" bytesread:" << m_stats_read_bytes <<
" read_s:"
73 << m_stats_read_timer * 1e-3 <<
" readmax_s:" << m_stats_read_longest * 1e-3
74 <<
" read_MBs:" << read_speed );
79 void *buf = m_bufferdata->
raw();
81 BUFLOG(
"CephIOAdapterAIORaw::write null buffer was provided.")
85 std::unique_ptr<XrdSfsAio> aiop = std::unique_ptr<XrdSfsAio>(
new CephBufSfsAio());
86 aiocb &sfsAio = aiop->sfsAio;
101 BUFLOG(
"CephIOAdapterAIORaw::write ceph_aio_write returned rc:" << rc)
105 while (!ceph_aiop->
isDone())
114 BUFLOG(
"CephIOAdapterAIORaw::write ceph_aiop->Result returned rc:" << rc)
120 m_stats_write_longest = std::max(m_stats_write_longest, dt_ns / 1000000);
121 m_stats_write_timer.fetch_add(dt_ns / 1000000);
122 m_stats_write_bytes.fetch_add(rc);
129 void *buf = m_bufferdata->
raw();
132 BUFLOG(
"CephIOAdapterAIORaw::read null buffer was provided.")
136 std::unique_ptr<XrdSfsAio> aiop = std::unique_ptr<XrdSfsAio>(
new CephBufSfsAio());
137 aiocb &sfsAio = aiop->sfsAio;
160 while (!ceph_aiop->
isDone())
169 m_stats_read_longest = std::max(m_stats_read_longest, dt_ns / 1000000);
170 m_stats_read_timer.fetch_add(dt_ns * 1e-6);
171 m_stats_read_bytes.fetch_add(rc);
std::chrono::steady_clock myclock
static void aioReadCallback(XrdSfsAio *aiop, size_t rc)
static void aioWriteCallback(XrdSfsAio *aiop, size_t rc)
ssize_t ceph_aio_write(int fd, XrdSfsAio *aiop, AioCB *cb)
ssize_t ceph_aio_read(int fd, XrdSfsAio *aiop, AioCB *cb)
virtual void doneWrite() override
std::unique_lock< std::mutex > m_lock
std::condition_variable m_condVar
virtual void doneRead() override
virtual ssize_t read(off64_t offset, size_t count) override
Issue a ceph_posix_pread to read to the buffer data from file offset and len count....
virtual ssize_t write(off64_t offset, size_t count) override
Take the data in the buffer and write to ceph at given offset Issues a ceph_posix_pwrite for data in ...
virtual ~CephIOAdapterAIORaw()
CephIOAdapterAIORaw(IXrdCephBufferData *bufferdata, int fd)
Interface to the Buffer's physical representation. Allow an interface to encapsulate the requirements...
virtual off_t setStartingOffset(off_t offset)=0
virtual void setLength(size_t len)=0
Currently occupied and valid space, which may be less than capacity.
virtual void setValid(bool isValid)=0
virtual const void * raw() const =0
write data into the buffer, store the external offset
virtual void doneRead()=0
virtual void doneWrite()=0
is a simple implementation of IXrdCephBufferData using std::vector<char> representation for the buffe...