diff mbox

[3/4] Add machine-info to benchmark output

Message ID 20140325103004.GC1850@spoyarek.pnq.redhat.com
State New
Headers show

Commit Message

Siddhesh Poyarekar March 25, 2014, 10:30 a.m. UTC
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
diff mbox

Patch

diff --git a/benchtests/Makefile b/benchtests/Makefile
index f5488c1..1669b6f 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -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 \
diff --git a/benchtests/scripts/machine-info.sh b/benchtests/scripts/machine-info.sh
new file mode 100755
index 0000000..3e51f1c
--- /dev/null
+++ b/benchtests/scripts/machine-info.sh
@@ -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 "}"