Skip to content

feat(network): support packet capture file creation#2275

Open
cagatay-y wants to merge 1 commit intohermit-os:mainfrom
cagatay-y:feat-pcap
Open

feat(network): support packet capture file creation#2275
cagatay-y wants to merge 1 commit intohermit-os:mainfrom
cagatay-y:feat-pcap

Conversation

@cagatay-y
Copy link
Copy Markdown
Contributor

@cagatay-y cagatay-y commented Feb 20, 2026

Allows creating packet capture files in the pcap format.

The feature also allows us to get nice graphs by using Wireshark's built-in tools.
1771604408

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Details
Benchmark Current: 4876b5b Previous: 5127c77 Performance Ratio
startup_benchmark Build Time 98.37 s 89.35 s 1.10
startup_benchmark File Size 0.79 MB 0.79 MB 1.00
Startup Time - 1 core 0.79 s (±0.03 s) 0.81 s (±0.03 s) 0.98
Startup Time - 2 cores 0.81 s (±0.03 s) 0.82 s (±0.03 s) 0.99
Startup Time - 4 cores 0.81 s (±0.03 s) 0.83 s (±0.02 s) 0.98
multithreaded_benchmark Build Time 92.42 s 92.62 s 1.00
multithreaded_benchmark File Size 0.89 MB 0.89 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 87.97 % (±6.39 %) 90.72 % (±8.59 %) 0.97
Multithreaded Pi Efficiency - 4 Threads 44.16 % (±2.81 %) 44.88 % (±4.39 %) 0.98
Multithreaded Pi Efficiency - 8 Threads 26.11 % (±2.36 %) 25.87 % (±3.25 %) 1.01
micro_benchmarks Build Time 97.67 s 100.57 s 0.97
micro_benchmarks File Size 0.90 MB 0.90 MB 1.00
Scheduling time - 1 thread 72.54 ticks (±3.55 ticks) 74.98 ticks (±4.47 ticks) 0.97
Scheduling time - 2 threads 39.87 ticks (±4.85 ticks) 40.19 ticks (±4.30 ticks) 0.99
Micro - Time for syscall (getpid) 2.96 ticks (±0.28 ticks) 2.97 ticks (±0.23 ticks) 1.00
Memcpy speed - (built_in) block size 4096 78572.15 MByte/s (±54256.05 MByte/s) 76264.90 MByte/s (±52720.43 MByte/s) 1.03
Memcpy speed - (built_in) block size 1048576 30467.16 MByte/s (±24926.49 MByte/s) 30292.34 MByte/s (±24927.05 MByte/s) 1.01
Memcpy speed - (built_in) block size 16777216 25748.39 MByte/s (±21401.91 MByte/s) 23336.56 MByte/s (±19347.79 MByte/s) 1.10
Memset speed - (built_in) block size 4096 78630.29 MByte/s (±54302.11 MByte/s) 76939.35 MByte/s (±53180.56 MByte/s) 1.02
Memset speed - (built_in) block size 1048576 31200.34 MByte/s (±25355.19 MByte/s) 31021.82 MByte/s (±25328.96 MByte/s) 1.01
Memset speed - (built_in) block size 16777216 26502.71 MByte/s (±21879.94 MByte/s) 24084.23 MByte/s (±19864.53 MByte/s) 1.10
Memcpy speed - (rust) block size 4096 71039.48 MByte/s (±49612.57 MByte/s) 67864.13 MByte/s (±47549.43 MByte/s) 1.05
Memcpy speed - (rust) block size 1048576 30363.94 MByte/s (±24936.06 MByte/s) 30092.92 MByte/s (±24855.28 MByte/s) 1.01
Memcpy speed - (rust) block size 16777216 25489.48 MByte/s (±21254.58 MByte/s) 23650.21 MByte/s (±19669.17 MByte/s) 1.08
Memset speed - (rust) block size 4096 71702.36 MByte/s (±50087.75 MByte/s) 67668.78 MByte/s (±47427.13 MByte/s) 1.06
Memset speed - (rust) block size 1048576 31116.40 MByte/s (±25362.45 MByte/s) 30783.24 MByte/s (±25249.62 MByte/s) 1.01
Memset speed - (rust) block size 16777216 26210.35 MByte/s (±21703.62 MByte/s) 24398.50 MByte/s (±20179.80 MByte/s) 1.07
alloc_benchmarks Build Time 90.82 s 96.87 s 0.94
alloc_benchmarks File Size 0.86 MB 0.86 MB 1.00
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 5744.60 Ticks (±430.20 Ticks) 5277.51 Ticks (±516.92 Ticks) 1.09
Allocations - Average Allocation time (no fail) 5744.60 Ticks (±430.20 Ticks) 5277.51 Ticks (±516.92 Ticks) 1.09
Allocations - Average Deallocation time 817.67 Ticks (±221.42 Ticks) 959.09 Ticks (±254.64 Ticks) 0.85
mutex_benchmark Build Time 91.05 s 91.13 s 1.00
mutex_benchmark File Size 0.90 MB 0.90 MB 1
Mutex Stress Test Average Time per Iteration - 1 Threads 12.96 ns (±0.92 ns) 13.26 ns (±0.96 ns) 0.98
Mutex Stress Test Average Time per Iteration - 2 Threads 15.62 ns (±10.43 ns) 20.28 ns (±12.66 ns) 0.77

This comment was automatically generated by workflow using github-action-benchmark.

@mkroening mkroening self-assigned this Feb 20, 2026
@cagatay-y cagatay-y force-pushed the feat-pcap branch 2 times, most recently from 5ab22eb to 9a29331 Compare February 25, 2026 16:41
Copy link
Copy Markdown
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cagatay-y cagatay-y force-pushed the feat-pcap branch 4 times, most recently from 3298de6 to 5107172 Compare March 9, 2026 16:59
Copy link
Copy Markdown
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! :)

);
} else {
info!(
"The packet capture will be written to a file called \"{file_name}\" under the mount point."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not print the full path? The mount point could be something other than /root.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is particularly useful to know where the file is placed in the guest file system tree. By mount point, I meant the one on the host, where the user will go to open the pcap file. What would be a clearer way to express that?

Comment on lines +70 to +83
type InterfaceDevice = cfg_select! {
all(feature = "net-trace", feature = "write-pcap-file") => {
smoltcp::phy::Tracer<smoltcp::phy::PcapWriter<NetworkDevice, crate::executor::device::FileSink>>
}
feature = "net-trace" => {
smoltcp::phy::Tracer<NetworkDevice>
}
feature = "write-pcap-file" => {
smoltcp::phy::PcapWriter<NetworkDevice, crate::executor::device::FileSink>
}
_ => {
NetworkDevice
}
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a bit more composable:

type PcapDevice = cfg_select! {
	feature = "write-pcap-file" => {
		smoltcp::phy::PcapWriter<NetworkDevice, crate::executor::device::FileSink>
	}
	_ => NetworkDevice,
};

type TracerDevice = cfg_select! {
	feature = "net-trace" => {
		smoltcp::phy::Tracer<PcapDevice>
	}
	_ => PcapDevice,
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about InnerDevice and InterfaceDevice? Having types called PcapDevice and TracerDevice in a case where we don't actually have a pcap writer or a tracer seems a bit confusing to me.

Allows creating packet capture files in the pcap format.

Co-authored-by: Martin Kröning <mkroening@posteo.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants