File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed
tests/kernel/mem_protect/demand_paging Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 66
77#include <ztest.h>
88#include <sys/mem_manage.h>
9+ #include <timing/timing.h>
910#include <mmu.h>
1011
1112#ifdef CONFIG_BACKING_STORE_RAM_PAGES
1415#error "Unsupported configuration"
1516#endif
1617
18+ #ifdef CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM
19+ #ifdef CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS
20+
21+ #ifdef CONFIG_BOARD_QEMU_X86
22+ unsigned long
23+ z_eviction_histogram_bounds [CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS ] = {
24+ 10000 ,
25+ 20000 ,
26+ 30000 ,
27+ 40000 ,
28+ 50000 ,
29+ 60000 ,
30+ 70000 ,
31+ 80000 ,
32+ 100000 ,
33+ ULONG_MAX
34+ };
35+
36+ unsigned long
37+ z_backing_store_histogram_bounds [CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS ] = {
38+ 10000 ,
39+ 50000 ,
40+ 100000 ,
41+ 150000 ,
42+ 200000 ,
43+ 250000 ,
44+ 500000 ,
45+ 750000 ,
46+ 1000000 ,
47+ ULONG_MAX
48+ };
49+ #else
50+ #error "Need to define paging histogram bounds"
51+ #endif
52+
53+ #endif /* CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS */
54+ #endif /* CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM */
55+
1756size_t arena_size ;
1857char * arena ;
1958
@@ -316,7 +355,11 @@ bool print_histogram(struct k_mem_paging_histogram_t *hist)
316355 for (idx = 0 ;
317356 idx < CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS ;
318357 idx ++ ) {
358+ #ifdef CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS
359+ time_ns = timing_cycles_to_ns (hist -> bounds [idx ]);
360+ #else
319361 time_ns = k_cyc_to_ns_ceil64 (hist -> bounds [idx ]);
362+ #endif
320363 printk (" <= %llu ns (%lu cycles): %lu\n" , time_ns ,
321364 hist -> bounds [idx ], hist -> counts [idx ]);
322365 if (hist -> counts [idx ] > 0U ) {
Original file line number Diff line number Diff line change 11tests :
2- kernel.memory_protection. demand_paging :
2+ kernel.demand_paging :
33 tags : kernel mmu demand_paging ignore_faults
44 filter : CONFIG_DEMAND_PAGING
5+ kernel.demand_paging.timing_funcs :
6+ tags : kernel mmu demand_paging ignore_faults
7+ platform_allow : qemu_x86_tiny
8+ filter : CONFIG_DEMAND_PAGING
9+ extra_configs :
10+ # The timing functions take up some more memory.
11+ # So need to shrink an even number of page to
12+ # compensate for that (default is 16).
13+ - CONFIG_BACKING_STORE_RAM_PAGES=14
14+ - CONFIG_DEMAND_PAGING_STATS_USING_TIMING_FUNCTIONS=y
You can’t perform that action at this time.
0 commit comments