[PATCH 3/4] Add machine-info to benchmark output
Siddhesh Poyarekar
siddhesh@redhat.com
Tue Mar 25 10:29:00 GMT 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140325/4f578518/attachment.sig>
More information about the Libc-alpha
mailing list