Skip to content

Commit 2e58a74

Browse files
guhetierCopilot
andcommitted
Address review comments: doc comments, typo, remove Reserved field
- Correct QUIC_WORKER_STATISTICS field comments to match implementation - Fix typo 'that as not' -> 'that has not' - Remove the Reserved padding field and reorder QUIC_WORKER_STATISTICS so the 64-bit fields precede IdealProcessor (no manual padding needed) - Zero output stats so any trailing padding bytes are deterministic - Regenerate Rust FFI bindings for the new layout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c4e784c commit 2e58a74

4 files changed

Lines changed: 14 additions & 20 deletions

File tree

src/inc/msquic.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,9 @@ typedef struct QUIC_XDP_MAP_CONFIG {
376376
// Per-worker statistics.
377377
//
378378
typedef struct QUIC_WORKER_STATISTICS {
379+
uint64_t CumulativeActiveTimeUs; // total time the worker spent active (not idle)
380+
uint64_t CumulativeWallTimeUs; // wall time since the worker thread started
379381
uint16_t IdealProcessor; // CPU the partition is affinitized to
380-
uint8_t Reserved[6]; // Padding for alignment
381-
uint64_t CumulativeActiveTimeUs; // total time IsActive == TRUE
382-
uint64_t CumulativeWallTimeUs; // wall time since worker was created
383382

384383
// -- append-only beyond this point --
385384
} QUIC_WORKER_STATISTICS;

src/platform/platform_worker.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,9 @@ CxPlatWorkerPoolGetStatistics(
890890
const uint64_t Now = CxPlatTimeUs64();
891891

892892
//
893-
// Note: The active time that as not been accumulated yet is ignored.
893+
// Note: The active time that has not been accumulated yet is ignored.
894894
//
895+
CxPlatZeroMemory(Stats, WorkerCount * sizeof(QUIC_WORKER_STATISTICS));
895896
for (uint32_t i = 0; i < WorkerCount; i++) {
896897
CXPLAT_WORKER* Worker = &WorkerPool->Workers[i];
897898
Stats[i].IdealProcessor = Worker->IdealProcessor;

src/rs/ffi/linux_bindings.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -521,24 +521,21 @@ const _: () = {
521521
#[repr(C)]
522522
#[derive(Debug, Copy, Clone)]
523523
pub struct QUIC_WORKER_STATISTICS {
524-
pub IdealProcessor: u16,
525-
pub Reserved: [u8; 6usize],
526524
pub CumulativeActiveTimeUs: u64,
527525
pub CumulativeWallTimeUs: u64,
526+
pub IdealProcessor: u16,
528527
}
529528
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
530529
const _: () = {
531530
["Size of QUIC_WORKER_STATISTICS"][::std::mem::size_of::<QUIC_WORKER_STATISTICS>() - 24usize];
532531
["Alignment of QUIC_WORKER_STATISTICS"]
533532
[::std::mem::align_of::<QUIC_WORKER_STATISTICS>() - 8usize];
534-
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
535-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 0usize];
536-
["Offset of field: QUIC_WORKER_STATISTICS::Reserved"]
537-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, Reserved) - 2usize];
538533
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeActiveTimeUs"]
539-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 8usize];
534+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 0usize];
540535
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeWallTimeUs"]
541-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 16usize];
536+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 8usize];
537+
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
538+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 16usize];
542539
};
543540
#[repr(C)]
544541
#[derive(Debug, Copy, Clone)]

src/rs/ffi/win_bindings.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -519,24 +519,21 @@ const _: () = {
519519
#[repr(C)]
520520
#[derive(Debug, Copy, Clone)]
521521
pub struct QUIC_WORKER_STATISTICS {
522-
pub IdealProcessor: u16,
523-
pub Reserved: [u8; 6usize],
524522
pub CumulativeActiveTimeUs: u64,
525523
pub CumulativeWallTimeUs: u64,
524+
pub IdealProcessor: u16,
526525
}
527526
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
528527
const _: () = {
529528
["Size of QUIC_WORKER_STATISTICS"][::std::mem::size_of::<QUIC_WORKER_STATISTICS>() - 24usize];
530529
["Alignment of QUIC_WORKER_STATISTICS"]
531530
[::std::mem::align_of::<QUIC_WORKER_STATISTICS>() - 8usize];
532-
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
533-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 0usize];
534-
["Offset of field: QUIC_WORKER_STATISTICS::Reserved"]
535-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, Reserved) - 2usize];
536531
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeActiveTimeUs"]
537-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 8usize];
532+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 0usize];
538533
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeWallTimeUs"]
539-
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 16usize];
534+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 8usize];
535+
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
536+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 16usize];
540537
};
541538
#[repr(C)]
542539
#[derive(Debug, Copy, Clone)]

0 commit comments

Comments
 (0)