'Get the number of CPUs in the host according to /proc/cpuinfo.'

def get_num_cpu(self):

    proc_cpuinfo = self.run('cat    /proc/cpuinfo', stdout_tee=open(os.devnull, 'w')).stdout
    cpus = 0
    for line in proc_cpuinfo.splitlines():
        if line.startswith('processor'):
            cpus += 1
    return cpus
