Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 | |
| 2 # physmem_alloc_analysis: Physical memory allocation analysis | |
| 3 | |
| 4 This directory contains code to profile physical memory allocation | |
| 5 for mmap, and analyze how contiguous the assigned physical frames are. | |
|
Mark Seaborn
2015/07/01 19:21:22
Can you also add a sentence or two on the motivati
ruiq
2015/07/01 20:42:59
Done.
| |
| 6 | |
| 7 ## How to run the program: | |
|
Mark Seaborn
2015/07/01 19:21:22
Nit: omit trailing ":" (for consistency with other
ruiq
2015/07/01 20:42:59
Done.
| |
| 8 | |
| 9 To compile and run the profiler: | |
| 10 | |
| 11 ``` | |
| 12 ./make.sh | |
| 13 ./physmem_alloc_profiler [-a alloc_size] [-s sleep_sec] | |
| 14 ``` | |
| 15 | |
| 16 The profiler mmaps a chunk of memory of `alloc_size` (pages) each time, | |
| 17 computes the assigned physical frames using `/proc/pid/pagemap` interface, | |
| 18 and munmaps it. It then sleeps `sleep_sec` (seconds) before the next iteration. | |
| 19 The program loops infinitely so manual Control-C is needed to stop it. | |
| 20 A file named `physmem_alloc_results` is generated to record the assigned | |
| 21 physical frame numbers. | |
| 22 | |
| 23 To analyze the results, run: | |
| 24 | |
| 25 ``` | |
| 26 ./analyze.sh | |
| 27 ``` | |
| 28 | |
| 29 This takes `physmem_alloc_results` as input and produces another file: | |
| 30 `contiguous_results`. As output, it shows the content of `contiguous_results` | |
| 31 and invokes gnuplot for plotting as well. | |
| 32 | |
| 33 ## Output format | |
| 34 | |
| 35 For `physmem_alloc_results`, each line contains information for each mmap | |
| 36 allocation. The assigned physical frame numbers of each page are separated | |
| 37 by space. | |
| 38 | |
| 39 For `contiguous_results` (which is also shown as output for analyze.sh), | |
| 40 each line is of the following format: | |
| 41 | |
| 42 ``` | |
| 43 size count size_total fraction | |
| 44 ``` | |
| 45 | |
| 46 where: | |
| 47 | |
| 48 * `size` is the size (in number of pages) of virtual memory area that | |
| 49 assigned with contiguous physical frames. | |
| 50 | |
| 51 * `count` is the number of times such virtual memory area appears. | |
| 52 | |
| 53 * `size_total` = `size` * `count`, i.e., it is the total size | |
| 54 (in number of pages) for such memory area. | |
| 55 | |
| 56 * `fraction` = `size_total` / `alloc_total`, where `alloc_total` is | |
| 57 the sum of `size_total` of all rows. Therefore, `fraction` means | |
| 58 out of all virtual pages, what fraction of them are inside an area | |
| 59 of `size` pages whose underlying physical memory frames are contiguous. | |
| 60 | |
| OLD | NEW |