Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
import
os
5
6
def
get_NumOfCores
():
7
cores=0
8
cpuinfo=open(
"/proc/cpuinfo"
,
"
r")
9
if
cpuinfo:
10
for
line
in
cpuinfo.readlines():
11
for
token
in
line.split():
12
if
token ==
'processor'
:
13
cores=cores+1;
14
return
cores
15
else
:
16
print
"Could not open file /proc/cpuinfo!\n"
17
return
NULL
18
#Further functions to parse other information will come (RAM, Cache etc)
cmsCpuInfo.get_NumOfCores
def get_NumOfCores
Definition:
cmsCpuInfo.py:6
Generated for CMSSW Reference Manual by
1.8.5