mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-24 17:30:47 +02:00
swap's block size made into a compile-time parameter
This commit is contained in:
@@ -62,6 +62,10 @@ namespace zmq
|
|||||||
// Maximal delta between high and low watermark.
|
// Maximal delta between high and low watermark.
|
||||||
max_wm_delta = 1024,
|
max_wm_delta = 1024,
|
||||||
|
|
||||||
|
// Swap inteligently batches data for writing to disk. The size of
|
||||||
|
// the batch in bytes is specified by this option.
|
||||||
|
swap_block_size = 8192,
|
||||||
|
|
||||||
// Maximum number of events the I/O thread can process in one go.
|
// Maximum number of events the I/O thread can process in one go.
|
||||||
max_io_events = 256,
|
max_io_events = 256,
|
||||||
|
|
||||||
|
|||||||
@@ -36,16 +36,17 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "swap.hpp"
|
#include "swap.hpp"
|
||||||
|
#include "config.hpp"
|
||||||
#include "atomic_counter.hpp"
|
#include "atomic_counter.hpp"
|
||||||
#include "err.hpp"
|
#include "err.hpp"
|
||||||
|
|
||||||
zmq::swap_t::swap_t (int64_t filesize_, size_t block_size_) :
|
zmq::swap_t::swap_t (int64_t filesize_) :
|
||||||
fd (-1),
|
fd (-1),
|
||||||
filesize (filesize_),
|
filesize (filesize_),
|
||||||
file_pos (0),
|
file_pos (0),
|
||||||
write_pos (0),
|
write_pos (0),
|
||||||
read_pos (0),
|
read_pos (0),
|
||||||
block_size (block_size_),
|
block_size (swap_block_size),
|
||||||
write_buf_start_addr (0)
|
write_buf_start_addr (0)
|
||||||
{
|
{
|
||||||
zmq_assert (filesize > 0);
|
zmq_assert (filesize > 0);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace zmq
|
|||||||
enum { default_block_size = 8192 };
|
enum { default_block_size = 8192 };
|
||||||
|
|
||||||
// Creates the swap.
|
// Creates the swap.
|
||||||
swap_t (int64_t filesize_, size_t block_size_ = default_block_size);
|
swap_t (int64_t filesize_);
|
||||||
|
|
||||||
~swap_t ();
|
~swap_t ();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user