Skip to content

Instantly share code, notes, and snippets.

View zhongshanxu's full-sized avatar

Zhongshan zhongshanxu

  • Fudan U.
  • Shanghai
View GitHub Profile
@zhongshanxu
zhongshanxu / toggleHT.sh
Created May 19, 2021 04:37 — forked from samueljon/toggleHT.sh
Disable / Enable HyperThreading cores on runtime - linux
#!/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,`