Skip to content

Instantly share code, notes, and snippets.

Avatar

Zhongshan zhongshanxu

  • shnicic
  • Shanghai
View GitHub Profile
@zhongshanxu
zhongshanxu / toggleHT.sh
Created May 19, 2021 — forked from samueljon/toggleHT.sh
Disable / Enable HyperThreading cores on runtime - linux
View toggleHT.sh
#!/bin/bash
HYPERTHREADING=1
function toggleHyperThreading() {
for CPU in /sys/devices/system/cpu/cpu[0-9]*; do
CPUID=`basename $CPU | cut -b4-`
echo -en "CPU: $CPUID\t"
[ -e $CPU/online ] && echo "1" > $CPU/online
THREAD1=`cat $CPU/topology/thread_siblings_list | cut -f1 -d,`