CMS 3D CMS Logo

cmsCpuInfo.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #Little script to get the number of cpus (cores) in the machine one is running on:
3 #Information is parsed from /proc/cpuinfo file
4 from __future__ import print_function
5 import os
6 
8  cores=0
9  cpuinfo=open("/proc/cpuinfo","r")
10  if cpuinfo:
11  for line in cpuinfo.readlines():
12  for token in line.split():
13  if token == 'processor':
14  cores=cores+1;
15  return cores
16  else:
17  print("Could not open file /proc/cpuinfo!\n")
18  return NULL
19  #Further functions to parse other information will come (RAM, Cache etc)
def get_NumOfCores()
Definition: cmsCpuInfo.py:7
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65