Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
70ad34e9
Unverified
Commit
70ad34e9
authored
Jun 11, 2021
by
Koakuma
Committed by
GitHub
Jun 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CPU core/frequency reading on Linux/SPARC systems (#1643)
parent
07ae5745
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
5 deletions
+38
-5
neofetch
neofetch
+38
-5
No files found.
neofetch
View file @
70ad34e9
...
@@ -2213,17 +2213,50 @@ get_cpu() {
...
@@ -2213,17 +2213,50 @@ get_cpu() {
speed="$((speed / 1000))"
speed="$((speed / 1000))"
else
else
speed="$(awk -F ': |\\.' '/cpu MHz|^clock/ {printf $2; exit}' "$cpu_file")"
case $kernel_machine in
speed="${speed/MHz}"
"sparc"*)
# SPARC systems use a different file to expose clock speed information.
speed_file="/sys/devices/system/cpu/cpu0/clock_tick"
speed="$(($(< "$speed_file") / 1000000))"
;;
*)
speed="$(awk -F ': |\\.' '/cpu MHz|^clock/ {printf $2; exit}' "$cpu_file")"
speed="${speed/MHz}"
;;
esac
fi
fi
# Get CPU temp.
# Get CPU temp.
[[ -f "$temp_dir" ]] && deg="$(($(< "$temp_dir") * 100 / 10000))"
[[ -f "$temp_dir" ]] && deg="$(($(< "$temp_dir") * 100 / 10000))"
# Get CPU cores.
# Get CPU cores.
case $cpu_cores in
case $kernel_machine in
"logical" | "on") cores="$(grep -c "^processor" "$cpu_file")" ;;
"sparc"*)
"physical") cores="$(awk '/^core id/&&!a[$0]++{++i} END {print i}' "$cpu_file")" ;;
case $cpu_cores in
# SPARC systems doesn't expose detailed topology information in
# /proc/cpuinfo so I have to use lscpu here.
"logical" | "on")
cores="$(lscpu | awk -F ': *' '/^CPU\(s\)/ {print $2}')"
;;
"physical")
cores="$(lscpu | awk -F ': *' '/^Core\(s\) per socket/ {print $2}')"
sockets="$(lscpu | awk -F ': *' '/^Socket\(s\)/ {print $2}')"
cores="$((sockets * cores))"
;;
esac
;;
*)
case $cpu_cores in
"logical" | "on")
cores="$(grep -c "^processor" "$cpu_file")"
;;
"physical")
cores="$(awk '/^core id/&&!a[$0]++{++i} END {print i}' "$cpu_file")"
;;
esac
;;
esac
esac
;;
;;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment