diff options
| author | Paul Buetow <paul@buetow.org> | 2013-07-26 09:01:55 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-07-26 09:01:55 +0200 |
| commit | aae81bc31444e9d9278ce8db9d63aafcae953460 (patch) | |
| tree | b490aea398aeb0422cf616b55443744ee72196c1 | |
| parent | d38f6b1aeb6e44831ceedc8b1d35347228f751a4 (diff) | |
retab, VERSION
| -rw-r--r-- | COPYING | 28 | ||||
| -rw-r--r-- | Makefile | 8 | ||||
| -rw-r--r-- | debian/changelog | 5 | ||||
| -rwxr-xr-x | src/cpuinfo | 94 |
4 files changed, 55 insertions, 80 deletions
diff --git a/COPYING b/COPYING deleted file mode 100644 index 3c9e340..0000000 --- a/COPYING +++ /dev/null @@ -1,28 +0,0 @@ -# cpuinfo (c) 2010, Dipl.-Inform. (FH) Paul Buetow -# -# E-Mail: cpuinfo@mx.buetow.org WWW: http://www.buetow.org -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of buetow.org nor the names of its contributors may -# be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED Paul Buetow ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT Paul C. Buetow BE LIABLE FOR ANY DIRECT, -# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. @@ -3,22 +3,20 @@ all: version documentation build # Builds the project. Since this is only a fake project, it just copies a script. build: - cp -p ./src/$(NAME) bin/$(NAME) + test ! -d ./bin && mkdir ./bin + cp -p ./src/$(NAME) ./bin/$(NAME) # 'install' installes a fake-root, which will be used to build the Debian package # $DESTDIR is actually set by the Debian tools. install: test ! -d $(DESTDIR)/usr/bin && mkdir -p $(DESTDIR)/usr/bin || exit 0 - test ! -d $(DESTDIR)/usr/share/$(NAME) && mkdir -p $(DESTDIR)/usr/share/$(NAME) || exit 0 cp ./bin/* $(DESTDIR)/usr/bin - #cp -r ./lib $(DESTDIR)/usr/share/$(NAME)/lib deinstall: test ! -z "$(DESTDIR)" && test -f $(DESTDIR)/usr/bin/$(NAME) && rm $(DESTDIR)/usr/bin/$(NAME) || exit 0 - test ! -z "$(DESTDIR)/usr/share/$(NAME)" && -d $(DESTDIR)/usr/share/$(NAME) && rm -r $(DESTDIR)/usr/share/$(NAME) || exit 0 clean: - rm bin/* + test -d ./bin && rm -Rf ./bin # ADDITIONAL RULES: diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..0231656 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +cpuinfo (0.0.0) stable; urgency=low + + * Initial version of the template + + -- Paul Buetow <paul@buetow.org> Fri, 04 Jan 2013 07:53:32 +0100 diff --git a/src/cpuinfo b/src/cpuinfo index 3e5ce01..d978c8b 100755 --- a/src/cpuinfo +++ b/src/cpuinfo @@ -3,64 +3,64 @@ # (c) Paul Buetow gawk -F: ' - function say ( str ) { - gsub(/ +/, " ", str) - printf "%s\n", str - } + function say ( str ) { + gsub(/ +/, " ", str) + printf "%s\n", str + } - # Newer versions of GAWK can use the built in length function instead - function alength ( arr ) { - len = 0 - for (var in arr) - len++ - return len - } + # Newer versions of GAWK can use the built in length function instead + function alength ( arr ) { + len = 0 + for (var in arr) + len++ + return len + } - function alength_min_1 ( arr ) { - len = alength(arr) - return len ? len : 1 - } + function alength_min_1 ( arr ) { + len = alength(arr) + return len ? len : 1 + } - BEGIN { - say( "cpuinfo (c) 0.2-pre1 2010 Paul Buetow" ) - say() - } + BEGIN { + say( "cpuinfo (c) VERSION Paul Buetow" ) + say() + } - $1 ~ /^core id/ { core_id[$2]++ } - $1 ~ /^physical id/ { physical_id[$2]++ } - $1 ~ /^processor/ { count["processor"]++ } + $1 ~ /^core id/ { core_id[$2]++ } + $1 ~ /^physical id/ { physical_id[$2]++ } + $1 ~ /^processor/ { count["processor"]++ } - { - key = $1 - gsub(/[ \t]+/, "", key) - info[key] = $2 - } + { + key = $1 + gsub(/[ \t]+/, "", key) + info[key] = $2 + } - END { - ht = info["siblings"] != alength(core_id) - physical_cpus = alength(physical_id) ? alength(physical_id) : 1 - + END { + ht = info["siblings"] != alength(core_id) + physical_cpus = alength(physical_id) ? alength(physical_id) : 1 + - say( info["modelname"] " " info["vendor_id"] " " info["cachesize"] " cache") - say() + say( info["modelname"] " " info["vendor_id"] " " info["cachesize"] " cache") + say() - say( sprintf("%s = %.3d %s", "p", physical_cpus, "Physical processors") ) - say( sprintf("%s = %.3d %s", "c", alength(core_id), "Cores" ) ) - say( sprintf("%s = %.3d %s", "s", info["siblings"], "Siblings (Hyper-Threading enabled if s != c)") ) - say( sprintf("%s = %.3d [v = p*c*(s != c ? 2 : 1)] %s", "v", count["processor"], "Total logical CPUs") ) - say( " Hyper-Threading is " ( ht ? "enabled" : "disabled" ) ) - say() + say( sprintf("%s = %.3d %s", "p", physical_cpus, "Physical processors") ) + say( sprintf("%s = %.3d %s", "c", alength(core_id), "Cores" ) ) + say( sprintf("%s = %.3d %s", "s", info["siblings"], "Siblings (Hyper-Threading enabled if s != c)") ) + say( sprintf("%s = %.3d [v = p*c*(s != c ? 2 : 1)] %s", "v", count["processor"], "Total logical CPUs") ) + say( " Hyper-Threading is " ( ht ? "enabled" : "disabled" ) ) + say() - if ( alength(core_id) ) - say( sprintf("%.7d %s", info["cpuMHz"], "MHz each core") ) + if ( alength(core_id) ) + say( sprintf("%.7d %s", info["cpuMHz"], "MHz each core") ) - say( sprintf("%.7d %s", info["cpuMHz"] * alength_min_1(core_id) * physical_cpus, "MHz total") ) + say( sprintf("%.7d %s", info["cpuMHz"] * alength_min_1(core_id) * physical_cpus, "MHz total") ) - if ( count["processor"] > 1 ) - say( sprintf("%.7d %s", info["bogomips"], "Bogomips each processor (including virtual)") ) + if ( count["processor"] > 1 ) + say( sprintf("%.7d %s", info["bogomips"], "Bogomips each processor (including virtual)") ) - say( sprintf("%.7d %s", info["bogomips"] * alength_min_1(core_id) * physical_cpus, "Bogomips total") ) - say() - } + say( sprintf("%.7d %s", info["bogomips"] * alength_min_1(core_id) * physical_cpus, "Bogomips total") ) + say() + } ' /proc/cpuinfo |
