This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 --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 "}"
-- 
1.8.3.1

Attachment: pgpUoQULtwUjQ.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]