2 #include "../XrdCephPosix.hh"
11 using myclock = std::chrono::steady_clock;
15 bool useStriperlessReads) :
16 m_bufferdata(bufferdata),m_fd(fd),
17 m_useStriperlessReads(useStriperlessReads) {
22 float read_speed{0}, write_speed{0};
23 if (m_stats_read_req.load() > 0 && m_stats_read_timer.load() > 0 ) {
24 read_speed = m_stats_read_bytes.load() / m_stats_read_timer.load() * 1e-6;
26 if (m_stats_write_req.load() > 0 && m_stats_read_timer.load() > 0 ) {
27 write_speed = m_stats_write_bytes.load() / m_stats_write_timer.load() * 1e-6;
29 BUFLOG(
"CephIOAdapterRaw::Summary fd:" << m_fd
30 <<
" nwrite:" << m_stats_write_req <<
" byteswritten:" << m_stats_write_bytes <<
" write_s:"
31 << m_stats_write_timer * 1e-6 <<
" writemax_s" << m_stats_write_longest * 1e-6
32 <<
" write_MBs:" << write_speed
33 <<
" nread:" << m_stats_read_req <<
" bytesread:" << m_stats_read_bytes <<
" read_s:"
34 << m_stats_read_timer * 1e-6 <<
" readmax_s:" << m_stats_read_longest * 1e-6
35 <<
" read_MBs:" << read_speed
36 <<
" striperlessRead: " << m_useStriperlessReads
42 const void* buf = m_bufferdata->
raw();
43 if (!buf)
return -EINVAL;
45 auto start = std::chrono::steady_clock::now();
47 auto end = std::chrono::steady_clock::now();
48 auto int_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end-start);
53 if (rc < 0)
return rc;
54 m_stats_write_longest = std::max(m_stats_write_longest,
static_cast<long long>(int_ns.count()));
55 m_stats_write_timer.fetch_add(
static_cast<long long>(int_ns.count()));
56 m_stats_write_bytes.fetch_add(rc);
63 void* buf = m_bufferdata->
raw();
70 auto start = std::chrono::steady_clock::now();
72 auto end = std::chrono::steady_clock::now();
74 auto int_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end-start);
77 BUFLOG(
"CephIOAdapterRaw::read: Error in read: " << rc );
81 m_stats_read_longest = std::max(m_stats_read_longest,
static_cast<long long>(int_ns.count()));
82 m_stats_read_timer.fetch_add(
static_cast<long long>(int_ns.count()));
83 m_stats_read_bytes.fetch_add(rc);
std::chrono::steady_clock myclock
ssize_t ceph_posix_maybestriper_pread(int fd, void *buf, size_t count, off64_t offset, bool allowStriper)
ssize_t ceph_posix_pwrite(int fd, const void *buf, size_t count, off64_t offset)
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 ~CephIOAdapterRaw()
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 ...
CephIOAdapterRaw(IXrdCephBufferData *bufferdata, int fd, bool useStriperlessReads)
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
is a simple implementation of IXrdCephBufferData using std::vector<char> representation for the buffe...