mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
number of cores with userland cat
This commit is contained in:
13
README.adoc
13
README.adoc
@@ -11016,12 +11016,23 @@ cat /proc/cpuinfo
|
|||||||
getconf _NPROCESSORS_CONF
|
getconf _NPROCESSORS_CONF
|
||||||
....
|
....
|
||||||
|
|
||||||
Or from <<user-mode-simulation>>, we can use <<sysconf>> with link:userland/linux/sysconf.c[] or <<cpp-multithreading>>'s link:userland/cpp/thread_hardware_concurrency.cpp[]:
|
Or from <<user-mode-simulation>>, we can use either of:
|
||||||
|
|
||||||
|
* <<sysconf>> with link:userland/linux/sysconf.c[]
|
||||||
|
+
|
||||||
....
|
....
|
||||||
./run --cpus 2 --emulator gem5 --userland userland/linux/sysconf.c | grep _SC_NPROCESSORS_ONLN
|
./run --cpus 2 --emulator gem5 --userland userland/linux/sysconf.c | grep _SC_NPROCESSORS_ONLN
|
||||||
|
....
|
||||||
|
* <<cpp-multithreading>>'s link:userland/cpp/thread_hardware_concurrency.cpp[]:
|
||||||
|
+
|
||||||
|
....
|
||||||
./run --cpus 2 --emulator gem5 --userland userland/cpp/thread_hardware_concurrency.cpp
|
./run --cpus 2 --emulator gem5 --userland userland/cpp/thread_hardware_concurrency.cpp
|
||||||
....
|
....
|
||||||
|
* direct access to several special filesystem files that contain this information e.g. via link:userland/c/cat.c[]:
|
||||||
|
+
|
||||||
|
....
|
||||||
|
./run --cpus 2 --emulator gem5 --userland userland/c/cat.c --cli-args /proc/cpuinfo
|
||||||
|
....
|
||||||
|
|
||||||
====== QEMU user mode multithreading
|
====== QEMU user mode multithreading
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user