test: mem_protect/demand_paging: support using timing funcs
This adds bits to support using timing functions for displaying paging histograms. Currently on qemu_x86_tiny is supported. Also shorten the test names. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
09e8db3d68
commit
b6fd177d92
2 changed files with 54 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <ztest.h>
|
||||
#include <sys/mem_manage.h>
|
||||
#include <timing/timing.h>
|
||||
#include <mmu.h>
|
||||
|
||||
#ifdef CONFIG_BACKING_STORE_RAM_PAGES
|
||||
|
@ -14,6 +15,44 @@
|
|||
#error "Unsupported configuration"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM
|
||||
#ifdef CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS
|
||||
|
||||
#ifdef CONFIG_BOARD_QEMU_X86
|
||||
unsigned long
|
||||
z_eviction_histogram_bounds[CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS] = {
|
||||
10000,
|
||||
20000,
|
||||
30000,
|
||||
40000,
|
||||
50000,
|
||||
60000,
|
||||
70000,
|
||||
80000,
|
||||
100000,
|
||||
ULONG_MAX
|
||||
};
|
||||
|
||||
unsigned long
|
||||
z_backing_store_histogram_bounds[CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS] = {
|
||||
10000,
|
||||
50000,
|
||||
100000,
|
||||
150000,
|
||||
200000,
|
||||
250000,
|
||||
500000,
|
||||
750000,
|
||||
1000000,
|
||||
ULONG_MAX
|
||||
};
|
||||
#else
|
||||
#error "Need to define paging histogram bounds"
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS */
|
||||
#endif /* CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM */
|
||||
|
||||
size_t arena_size;
|
||||
char *arena;
|
||||
|
||||
|
@ -316,7 +355,11 @@ bool print_histogram(struct k_mem_paging_histogram_t *hist)
|
|||
for (idx = 0;
|
||||
idx < CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS;
|
||||
idx++) {
|
||||
#ifdef CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS
|
||||
time_ns = timing_cycles_to_ns(hist->bounds[idx]);
|
||||
#else
|
||||
time_ns = k_cyc_to_ns_ceil64(hist->bounds[idx]);
|
||||
#endif
|
||||
printk(" <= %llu ns (%lu cycles): %lu\n", time_ns,
|
||||
hist->bounds[idx], hist->counts[idx]);
|
||||
if (hist->counts[idx] > 0U) {
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
tests:
|
||||
kernel.memory_protection.demand_paging:
|
||||
kernel.demand_paging:
|
||||
tags: kernel mmu demand_paging ignore_faults
|
||||
filter: CONFIG_DEMAND_PAGING
|
||||
kernel.demand_paging.timing_funcs:
|
||||
tags: kernel mmu demand_paging ignore_faults
|
||||
platform_allow: qemu_x86_tiny
|
||||
filter: CONFIG_DEMAND_PAGING
|
||||
extra_configs:
|
||||
# The timing functions take up some more memory.
|
||||
# So need to shrink an even number of page to
|
||||
# compensate for that (default is 16).
|
||||
- CONFIG_BACKING_STORE_RAM_PAGES=14
|
||||
- CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS=y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue