Skip to content

Commit 0981777

Browse files
committed
Add max_fragment_size fn for benchmarks
1 parent 154444f commit 0981777

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/platform/windows/mod.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ const MAGIC_NO_OUTSTANDING_DATA_CODE: u32 = MAGIC_CODE_BASE + 0;
5252
const MAGIC_CHANNEL_CLOSED_CODE: u32 = MAGIC_CODE_BASE + 1;
5353

5454
// When we create the pipe, how big of a write buffer do we specify?
55-
// This is reserved in the nonpaged pool.
56-
//
57-
// This is 80k because a lot of the test assume that we can write a
58-
// 64k buffer without fragmentation. This is unfortunate.
59-
const WRITE_BUFFER_SIZE: usize = 80 * 1024; // 64k+16k
55+
// This is reserved in the nonpaged pool. The fragment size is the
56+
// max we can write to the pipe without fragmentation, and the
57+
// buffer size is what we tell the pipe it is, so we have room
58+
// for out of band data etc. We can probably do way less than
59+
// 16k extra.
60+
const MAX_FRAGMENT_SIZE: usize = 64 * 1024;
61+
const WRITE_BUFFER_SIZE: usize = MAX_FRAGMENT_SIZE + 16*1024;
6062

6163
// When we read, how big of a heap buffer do we allocate?
6264
const READ_BUFFER_SIZE: usize = 128 * 1024; //128k;
@@ -834,6 +836,10 @@ impl OsIpcSender {
834836
OsIpcSender::connect_pipe_id(Uuid::parse_str(&name).unwrap())
835837
}
836838

839+
pub fn get_max_fragment_size() -> usize {
840+
MAX_FRAGMENT_SIZE
841+
}
842+
837843
fn from_handle(handle: HANDLE) -> OsIpcSender {
838844
OsIpcSender {
839845
handle: WinHandle::new(handle),

0 commit comments

Comments
 (0)