Skip to content

Add performance tests for map operations from user mode#5067

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-perf-tests-user-mode
Draft

Add performance tests for map operations from user mode#5067
Copilot wants to merge 2 commits intomainfrom
copilot/add-perf-tests-user-mode

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

Description

Adds user-mode map operation performance tests to complement the existing kernel-side perf tests. The new tests exercise the libbpf-compatible API path (bpf_map_create, bpf_map_lookup_elem, bpf_map_update_elem) through the mock execution stack, enabling measurement of the full user→kernel API overhead.

New file: tests/performance/UserMode.cpp

  • Covers 5 map types: BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PERCPU_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, BPF_MAP_TYPE_LRU_HASH
  • Test operations: bpf_map_lookup_elem and bpf_map_update_elem for all types; plus LRU-specific rolling update/lookup (eviction pressure) tests
  • Pre-allocates per-CPU value buffers (sized sizeof(uint64_t) * cpu_count for percpu maps) to isolate map op latency from allocator overhead
  • Initializes via _test_helper_end_to_end — same mock API stack pattern as unit/stress tests

Updated: tests/performance/performance.vcxproj / .filters

  • Compiles UserMode.cpp, libs/thunk/mock/mock.cpp, tests/end_to_end/test_helper.cpp
  • Adds project references for the full user-mode API stack (api, api_common, service, pe-parse, ebpfnetsh, prevail, bpf2c, test_util, common_tests, ubpf_user, rpc_interface) — mirrors the dependency set used by stress tests

Testing

New tests are added in UserMode.cpp and integrated into the existing tests\performance project. Each map type × operation combination generates two Catch2 test cases (preemptible and non-preemptible), yielding 24 new perf test cases tagged [performance_UserMode].

Documentation

No documentation impact.

Installation

No installer impact.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add perf tests for map operations from user mode</issue_title>
<issue_description>We currently have perf tests for map operations from BPF programs, but not from user mode.
This issue is to track adding perf tests for map operations from user mode.

This should cover different map types.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: shankarseal <74580197+shankarseal@users.noreply.github.com>
Copilot AI changed the title [WIP] Add performance tests for map operations from user mode Add performance tests for map operations from user mode Mar 2, 2026
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.

Add perf tests for map operations from user mode

2 participants