8 from vstf.common.utils import check_call, check_output
10 LOG = logging.getLogger(__name__)
13 def get_pid_by_name(process_name):
14 out = check_output(['ps', '-A'])
16 for line in out.splitlines():
18 pid, name = values[0], values[3]
19 if process_name == name:
25 cpu_num = check_output('cat /proc/cpuinfo | grep processor | wc -l', shell=True).strip()
26 cpu_num = int(cpu_num)
30 def get_default_threads():
31 cpu_num = get_cpu_num()
32 return 2 if cpu_num > 3 * 3 else 1
35 def modprobe_pktgen():
36 check_call('modprobe pktgen', shell=True)
41 check_call("ifconfig %s up" % device, shell=True)