mirror of
https://github.com/andreas-abel/nanoBench.git
synced 2025-12-16 03:20:08 +01:00
add -cpu option to kernel-nanobench
This commit is contained in:
@@ -143,13 +143,13 @@ Both `nanoBench.sh` and `kernel-nanoBench.sh` support the following command-line
|
||||
| `-min` | Selects the minimum as the aggregate function. |
|
||||
| `-basic_mode` | The effect of this option is described in the [Generated Code](#generated-code) section. |
|
||||
| `-no_mem` | If this option is enabled, the code for `read_perf_ctrs` does not make any memory accesses and stores all performance counter values in registers. This can, for example, be useful for benchmarks that require that the state of the data caches does not change after the execution of `code_init`. *If this option is used, the code to be benchmarked must not modify registers* ***R8-R11 (Intel)*** *and* ***R8-R13 (AMD).*** *Furthermore, `read_perf_ctrs` will modify* ***RAX, RCX, and RDX***. |
|
||||
| `-cpu <n>` | Pins the measurement thread to CPU n. `[Default: Pin the thread to the CPU it is currently running on.]` |
|
||||
| `-verbose` | Outputs the results of all performance counter readings. In the user-space version, the results are printed to stdout. The output of the kernel module can be accessed using `dmesg`. |
|
||||
|
||||
The following parameters are only supported by `nanoBench.sh`.
|
||||
|
||||
| Option | Description |
|
||||
|------------|-------------|
|
||||
| `-cpu <n>` | Pins the measurement thread to CPU n. `[Default: Pin the thread to the CPU it is currently running on.]` |
|
||||
| `-usr <n>` | If n=1, performance events are counted when the processor is operating at a privilege level greater than 0. `[Default: n=1]` |
|
||||
| `-os <n>` | If n=1, performance events are counted when the processor is operating at privilege level 0. `[Default: n=0]` |
|
||||
| `-debug` | Enables the debug mode (see [below](#debug-mode)). |
|
||||
|
||||
@@ -14,6 +14,8 @@ fi
|
||||
|
||||
cat /sys/nb/reset
|
||||
|
||||
taskset=""
|
||||
|
||||
while [ "$1" ]; do
|
||||
if [[ "$1" == -asm_init ]]; then
|
||||
echo ".intel_syntax noprefix" > asm-init.s
|
||||
@@ -35,6 +37,9 @@ while [ "$1" ]; do
|
||||
elif [[ "$1" == -code ]]; then
|
||||
cp "$2" /sys/nb/code
|
||||
shift 2
|
||||
elif [[ "$1" == -cpu ]]; then
|
||||
taskset="taskset -c $2"
|
||||
shift 2
|
||||
elif [[ "$1" == -config ]]; then
|
||||
cp "$2" /sys/nb/config
|
||||
shift 2
|
||||
@@ -89,7 +94,8 @@ while [ "$1" ]; do
|
||||
echo " -min: Selects the minimum as the aggregate function."
|
||||
echo " -basic_mode: Enables basic mode."
|
||||
echo " -no_mem: The code for reading the perf. ctrs. does not make memory accesses."
|
||||
echo " -verbose: Outputs the results of all performance counter readings."
|
||||
echo " -cpu <n>: Pins the measurement thread to CPU n."
|
||||
echo " -verbose: Outputs the results of all performance counter readings."
|
||||
exit 0
|
||||
else
|
||||
echo "Invalid option: $1"
|
||||
@@ -97,4 +103,4 @@ while [ "$1" ]; do
|
||||
fi
|
||||
done
|
||||
|
||||
cat /sys/nb/run
|
||||
$taskset cat /sys/nb/run
|
||||
|
||||
Reference in New Issue
Block a user