Main Page
Namespaces
Classes
Package Documentation
Validation
Performance
scripts
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
7
def
get_NumOfCores
():
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)
cmsCpuInfo.get_NumOfCores
def get_NumOfCores()
Definition:
cmsCpuInfo.py:7
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition:
JobReport.cc:65
Generated for CMSSW Reference Manual by
1.8.11