mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
gem5: benchmark hdf5 stats
This commit is contained in:
20
README.adoc
20
README.adoc
@@ -202,6 +202,8 @@ The link:build[] script is just a lightweight wrapper that calls the smaller bui
|
||||
./build --dry-run
|
||||
....
|
||||
|
||||
see also: <<dry-run>>.
|
||||
|
||||
When you reach difficulties, QEMU makes it possible to easily GDB step debug the Linux kernel source code, see: xref:gdb[xrefstyle=full].
|
||||
|
||||
===== Your first kernel module hack
|
||||
@@ -254,6 +256,8 @@ You can see that `./build` does that as well, by running:
|
||||
./build --dry-run
|
||||
....
|
||||
|
||||
See also: <<dry-run>>.
|
||||
|
||||
`--eval-after` is optional: you could just type `insmod hello.ko` in the terminal, but this makes it run automatically at the end of boot, and then drops you into a shell.
|
||||
|
||||
If the guest and host are the same arch, typically x86_64, you can speed up boot further with <<kvm>>:
|
||||
@@ -531,6 +535,7 @@ Read the following sections for further introductory material:
|
||||
* <<introduction-to-qemu>>
|
||||
* <<introduction-to-buildroot>>
|
||||
|
||||
[[dry-run]]
|
||||
=== Dry run to get commands for your project
|
||||
|
||||
One of the major features of this repository is that we try to support the `--dry-run` option really well for all scripts.
|
||||
@@ -11879,7 +11884,6 @@ To use that file, first rebuild `m5ops.out` with the m5ops instructions enabled
|
||||
....
|
||||
./build-userland \
|
||||
--arch aarch64 \
|
||||
--ccflags='-DLKMC_M5OPS_ENABLE=1' \
|
||||
--force-rebuild \
|
||||
userland/c/m5ops.c \
|
||||
;
|
||||
@@ -12180,7 +12184,19 @@ as explained in:
|
||||
gem5.opt --stats-help
|
||||
....
|
||||
|
||||
TODO what is the advantage? The generated file for `--stats-file h5://stats.h5?desc=False` in LKMC f42c525d7973d70f4c836d2169cc2bd2893b4197 gem5 5af26353b532d7b5988cf0f6f3d0fbc5087dd1df was 946K, so much larger than the text version!
|
||||
This is not exposed in LKMC f42c525d7973d70f4c836d2169cc2bd2893b4197 however, you just have to <<dry-run,hack the gem5 CLI for now>>.
|
||||
|
||||
TODO what is the advantage? The generated file for `--stats-file h5://stats.h5?desc=False` in LKMC f42c525d7973d70f4c836d2169cc2bd2893b4197 gem5 5af26353b532d7b5988cf0f6f3d0fbc5087dd1df for a single dump was 946K, so much larger than the text version seen at <<gem5-m5out-stats-txt-file>> which was only 59KB max!
|
||||
|
||||
We then try to see if it is any better when you have a bunch of dump events:
|
||||
|
||||
....
|
||||
./run --arch aarch64 --emulator gem5 --userland userland/c/m5ops.c --userland-args 'd 1000'
|
||||
....
|
||||
|
||||
and there yes, we see that the file size fell from 39MB on `stats.txt` to 3.2MB on `stats.m5`, so the increase observed previously was just due to some initial size overhead.
|
||||
|
||||
We also note however that the stat dump made the such a simulation that just loops and dumps considerably slower, from 3s to 15s on <<p51>>. Fascinating, we are definitely not disk bound there.
|
||||
|
||||
===== gem5 only dump selected stats
|
||||
|
||||
|
||||
@@ -239,6 +239,8 @@ We aim display every command that modifies the filesystem state, and generate
|
||||
Bash equivalents even for actions taken directly in Python without shelling out.
|
||||
|
||||
mkdir are generally omitted since those are obvious
|
||||
|
||||
See also: https://cirosantilli.com/linux-kernel-module-cheat#dry-run
|
||||
'''
|
||||
)
|
||||
self.add_argument(
|
||||
|
||||
@@ -649,6 +649,7 @@ path_properties_tuples = (
|
||||
'file_write_read.c': {'baremetal': False},
|
||||
'getchar.c': {'interactive': True},
|
||||
'malloc_max.c': {'disrupts_system': True},
|
||||
'm5ops.c': {'allowed_emulators': {'gem5'}},
|
||||
'return1.c': {'exit_status': 1},
|
||||
'return2.c': {'exit_status': 2},
|
||||
}
|
||||
@@ -669,6 +670,7 @@ path_properties_tuples = (
|
||||
},
|
||||
),
|
||||
'count.cpp': {'more_than_1s': True},
|
||||
'm5ops.cpp': {'allowed_emulators': {'gem5'}},
|
||||
'parallel_sort.cpp': {'minimum_gcc_version': (9, 0, 0)},
|
||||
'sleep_for.cpp': {
|
||||
'more_than_1s': True,
|
||||
|
||||
@@ -1,34 +1,42 @@
|
||||
/* https://cirosantilli.com/linux-kernel-module-cheat#m5ops-instructions */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define LKMC_M5OPS_ENABLE 1
|
||||
#include <lkmc/m5ops.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char action;
|
||||
unsigned long long loops;
|
||||
|
||||
if (argc > 1) {
|
||||
action = argv[1][0];
|
||||
} else {
|
||||
action = 'e';
|
||||
}
|
||||
switch (action) {
|
||||
case 'c':
|
||||
LKMC_M5OPS_CHECKPOINT;
|
||||
break;
|
||||
case 'd':
|
||||
LKMC_M5OPS_DUMPSTATS;
|
||||
break;
|
||||
case 'e':
|
||||
LKMC_M5OPS_EXIT;
|
||||
break;
|
||||
case 'f':
|
||||
LKMC_M5OPS_FAIL_1;
|
||||
break;
|
||||
case 'r':
|
||||
LKMC_M5OPS_RESETSTATS;
|
||||
break;
|
||||
if (argc > 2) {
|
||||
loops = strtoull(argv[2], NULL, 0);
|
||||
} else {
|
||||
loops = 1;
|
||||
}
|
||||
for (unsigned long long i = 0; i < loops; i++) {
|
||||
switch (action) {
|
||||
case 'c':
|
||||
LKMC_M5OPS_CHECKPOINT;
|
||||
break;
|
||||
case 'd':
|
||||
LKMC_M5OPS_DUMPSTATS;
|
||||
break;
|
||||
case 'e':
|
||||
LKMC_M5OPS_EXIT;
|
||||
break;
|
||||
case 'f':
|
||||
LKMC_M5OPS_FAIL_1;
|
||||
break;
|
||||
case 'r':
|
||||
LKMC_M5OPS_RESETSTATS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* https://cirosantilli.com/linux-kernel-module-cheat#m5ops-instructions */
|
||||
|
||||
#define LKMC_M5OPS_ENABLE 1
|
||||
#include <lkmc/m5ops.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
Reference in New Issue
Block a user