Skip to content

Commit

Permalink
Ioring stream buffer enhancements (#147)
Browse files Browse the repository at this point in the history
* Add Fragment::push(Fragment) overloads.

* Remove -march=native, -mtune=native for better compatibility.

* Fix compile error.
  • Loading branch information
tonyastolfi authored Mar 29, 2024
1 parent 45a9138 commit d28435f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ add_compile_definitions(_BITS_UIO_EXT_H=1)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer")

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -march=native -mtune=native ") # -pg
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -march=native -mtune=native") # -pg
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer")

if(APPLE)
set(BACKTRACE_DEPENDENCY "")
Expand Down
18 changes: 18 additions & 0 deletions src/llfs/ioring_stream_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,24 @@ void IoRingStreamBuffer::Fragment::push(BufferView&& view)
this->views_.emplace_back(std::move(view));
}

//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - -
//
void IoRingStreamBuffer::Fragment::push(const Fragment& fragment)
{
for (const BufferView& part : fragment.views_) {
this->push(batt::make_copy(part));
}
}

//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - -
//
void IoRingStreamBuffer::Fragment::push(Fragment&& fragment)
{
for (BufferView& part : fragment.views_) {
this->push(std::move(part));
}
}

//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - -
//
auto IoRingStreamBuffer::Fragment::pop(usize max_byte_count) -> Fragment
Expand Down
9 changes: 9 additions & 0 deletions src/llfs/ioring_stream_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ class IoRingStreamBuffer
*/
void push(BufferView&& view);

/** \brief Pushes the specified Fragment onto the end of this sequence.
*/
void push(const Fragment& other);

/** \brief Pushes the specified Fragment onto the end of this sequence, consuming the Fragment
* in the process.
*/
void push(Fragment&& other);

/** \brief Removes up to the specified number of bytes from the beginning of this sequence,
* returning the resulting BufferView slices as a Fragment.
*/
Expand Down

0 comments on commit d28435f

Please sign in to comment.