Skip to content

Commit

Permalink
feat: add cpu_info.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kral2 committed Sep 8, 2021
1 parent 4300b12 commit 87ec183
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Given a version number MAJOR.MINOR.PATCH:
- MINOR version when adding functionality in a backwards compatible manner,
- PATCH version when making backwards compatible bug fixes.

## [0.5.0] - 2021-09-03

## Added

- cpu_info.sh: show cpu specific information (brand, model, core count, thread count)

## [0.4.0] - 2021-09-03

## Added
Expand Down
25 changes: 25 additions & 0 deletions system-config/cpu_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# List CPU information
# https://apple.stackexchange.com/questions/352769/does-macos-have-a-command-to-retrieve-detailed-cpu-information-like-proc-cpuinf/352770


if [ -z "$1" ]; then
sysctl -n machdep.cpu.brand_string
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
sysctl -a | grep machdep.cpu.thread_count | sed 's/machdep.//'
elif [ "$1" = "--all" ]; then
sysctl -a | grep machdep.cpu
elif [ "$1" = "--short" ]; then
sysctl -n machdep.cpu.brand_string
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
sysctl -a | grep machdep.cpu.thread_count | sed 's/machdep.//'
elif [ "$1" = "--help" ]; then
echo "Usage information: ./cpu_info.sh [short|all]"
echo "- short: print CPU Brand/Model, Core count, Thread count"
echo "- all: print all cpu information"
else
echo "Usage information: ./cpu_info.sh [short|all]"
echo "- short: print CPU Brand/Model, Core count, Thread count"
echo "- all: print all cpu information"
fi

0 comments on commit 87ec183

Please sign in to comment.