[3/4] Add machine-info to benchmark output
Commit Message
Hi,
This patch adds a script that is invoked by the benchmark target to
print information about the machine the current benchmark is running
on.
Siddhesh
* benchtests/scripts/machine-info.sh: New file.
* benchtests/Makefile (bench-func): Use it.
---
benchtests/Makefile | 3 +++
benchtests/scripts/machine-info.sh | 14 ++++++++++++++
2 files changed, 17 insertions(+)
create mode 100755 benchtests/scripts/machine-info.sh
@@ -125,6 +125,9 @@ bench-set: $(binaries-benchset)
# capable language or tool.
bench-func: $(binaries-bench)
{ echo "{"; \
+ echo " \"machine\":"; \
+ $(.)scripts/machine-info.sh; \
+ echo ","; \
$(timing-type); \
echo " ,\"functions\": {"; \
for run in $^; do \
new file mode 100755
@@ -0,0 +1,14 @@
+#!/bin/sh
+# Simple script to get some basic machine information
+
+echo "{"
+sed -n -e 's/vendor_id[ \t]\+: \(.*\)/ "vendor-id": "\1",/p' \
+ -e 's/cpu family[ \t]\+: \(.*\)/ "cpu-family": \1,/p' \
+ -e 's/\(model\)[ \t]\+: \(.*\)/ "\1": \2,/p' \
+ -e 's/cpu cores[ \t]\+: \(.*\)/ "cpu-cores": \1,/p' \
+ -e 's/cache size[ \t]\+: \([0-9]\+\).*/ "cache-size": \1,/p' \
+ -e 's/MemTotal:[ \t]\+\([0-9]\+\).*/ "memory": \1,/p' \
+ -e 's/SwapTotal:[ \t]\+\([0-9]\+\).*/ "swap": \1,/p' \
+ /proc/cpuinfo /proc/meminfo | sort -u
+echo " \"processors\": $(grep -c 'processor' /proc/cpuinfo)"
+echo "}"