Skip to content

Commit 87ec183

Browse files
committed
feat: add cpu_info.sh
1 parent 4300b12 commit 87ec183

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Given a version number MAJOR.MINOR.PATCH:
1414
- MINOR version when adding functionality in a backwards compatible manner,
1515
- PATCH version when making backwards compatible bug fixes.
1616

17+
## [0.5.0] - 2021-09-03
18+
19+
## Added
20+
21+
- cpu_info.sh: show cpu specific information (brand, model, core count, thread count)
22+
1723
## [0.4.0] - 2021-09-03
1824

1925
## Added

system-config/cpu_info.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# List CPU information
4+
# https://apple.stackexchange.com/questions/352769/does-macos-have-a-command-to-retrieve-detailed-cpu-information-like-proc-cpuinf/352770
5+
6+
7+
if [ -z "$1" ]; then
8+
sysctl -n machdep.cpu.brand_string
9+
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
10+
sysctl -a | grep machdep.cpu.thread_count | sed 's/machdep.//'
11+
elif [ "$1" = "--all" ]; then
12+
sysctl -a | grep machdep.cpu
13+
elif [ "$1" = "--short" ]; then
14+
sysctl -n machdep.cpu.brand_string
15+
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
16+
sysctl -a | grep machdep.cpu.thread_count | sed 's/machdep.//'
17+
elif [ "$1" = "--help" ]; then
18+
echo "Usage information: ./cpu_info.sh [short|all]"
19+
echo "- short: print CPU Brand/Model, Core count, Thread count"
20+
echo "- all: print all cpu information"
21+
else
22+
echo "Usage information: ./cpu_info.sh [short|all]"
23+
echo "- short: print CPU Brand/Model, Core count, Thread count"
24+
echo "- all: print all cpu information"
25+
fi

0 commit comments

Comments
 (0)