千家信息网

实现Linux 进程绑定CPU 技术

发表于:2025-02-11 作者:千家信息网编辑
千家信息网最后更新 2025年02月11日,快速绑定ceph osd 到CPU 核上import os,sys,timeimport commandscount=0pids = commands.getoutput(""" ps -ef |gr
千家信息网最后更新 2025年02月11日实现Linux 进程绑定CPU 技术

快速绑定ceph osd 到CPU 核上

import os,sys,timeimport commandscount=0pids = commands.getoutput(""" ps -ef |grep ceph-osd|grep -v grep|awk '{print $2}' """)for i in pids.split("\n"):    count += 1    os.system("taskset -cp %s %s" %(count,i))    print "taskset -cp %s %s" %(count,i)
import os,sys,timeimport commandscount=0pids = commands.getoutput(""" ps -ef |grep ceph-osd|grep -v grep|awk '{print $2}' """)for i in pids.split("\n"):    count += 1    os.system("taskset -cp %s %s" %(count,i))    print "taskset -cp %s %s" %(count,i) import os,sys,timeimport commandscount=0pids = commands.getoutput(""" ps -ef |grep ceph-osd|grep -v grep|awk '{print $2}' """)for i in pids.split("\n"):    count += 1    os.system("taskset -cp %s %s" %(count,i))    print "taskset -cp %s %s" %(count,i) import os,sys,timeimport commandscount=0pids = commands.getoutput(""" ps -ef |grep ceph-osd|grep -v grep|awk '{print $2}' """)for i in pids.split("\n"):    count += 1    os.system("taskset -cp %s %s" %(count,i))    print "taskset -cp %s %s" %(count,i)
0