Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
24caaa91
Commit
24caaa91
authored
Jul 02, 2007
by
Pramod R Sanaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed a bit of the FFT code. FFT is very efficient with input sizes as power of 2.
parent
b6fd715d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
8 deletions
+43
-8
pelab/SanityCheck.py
pelab/SanityCheck.py
+43
-8
No files found.
pelab/SanityCheck.py
View file @
24caaa91
...
...
@@ -389,7 +389,29 @@ def PreProcess(inputFile, outputFile):
del
timeArray
del
valueArray
#}
##############################################################
##############################################################
def
FindPowerOf2
(
n
):
#{
mask
=
1
bitPosition
=
0
multipleOf2
=
0
for
i
in
range
(
1
,
32
):
#{
if
n
&
mask
==
mask
:
bitPosition
=
i
multipleOf2
+=
1
mask
=
mask
*
2
#}
if
multipleOf2
==
1
:
return
n
else
:
return
int
(
math
.
pow
(
2
,
bitPosition
))
#}
##############################################################
##############################################################
def
CalcCorrelationFFT
(
InFile1
,
InFile2
,
transportFlag
,
plabAvg
,
elabAvg
):
...
...
@@ -418,9 +440,13 @@ def CalcCorrelationFFT(InFile1, InFile2, transportFlag, plabAvg, elabAvg):
n
=
rows2
#}
x
=
[
0.0
]
*
n
y
=
[
0.0
]
*
n
arraySize
=
FindPowerOf2
(
n
)
x
=
[
0.0
]
*
arraySize
y
=
[
0.0
]
*
arraySize
xFFT
=
empty
(
arraySize
,
complex
)
yFFT
=
empty
(
arraySize
,
complex
)
count1
=
0
for
lineRead
in
InFileHandle1
:
...
...
@@ -450,8 +476,8 @@ def CalcCorrelationFFT(InFile1, InFile2, transportFlag, plabAvg, elabAvg):
xFFT
=
fft
(
x
)
yFFT
=
fft
(
y
)
inverseCorrArray
=
[
0.0
+
0.0j
]
*
(
n
)
corrArray
=
[
0.0
+
0.0j
]
*
(
n
)
inverseCorrArray
=
empty
(
arraySize
,
complex
)
corrArray
=
empty
(
arraySize
,
complex
)
for
i
in
range
(
0
,
n
):
#{
...
...
@@ -818,7 +844,7 @@ def Main():
#{
global
minAvgSamples
global
avgTime
global
maxAvgSamples
global
maxAvgSamples
global
logDir
global
OutputFileHandle
...
...
@@ -836,13 +862,13 @@ def Main():
default
=
False
,
help
=
"Use Bucket average instead of Moving average"
)
cmdParser
.
add_option
(
"-a"
,
"--avgTime"
,
action
=
"store"
,
dest
=
"avgTime"
,
\
default
=
2000000
,
help
=
"Time period for Moving/Bucket Average"
)
type
=
"int"
,
default
=
2000000
,
help
=
"Time period for Moving/Bucket Average"
)
cmdParser
.
add_option
(
"-m"
,
"--minSamples"
,
action
=
"store"
,
dest
=
"minAvgSamples"
,
\
default
=
100
,
help
=
"Min Samples for Moving Average"
)
type
=
"int"
,
default
=
100
,
help
=
"Min Samples for Moving Average"
)
cmdParser
.
add_option
(
"-x"
,
"--maxSamples"
,
action
=
"store"
,
dest
=
"maxAvgSamples"
,
\
default
=
500
,
help
=
"Max Samples for Moving Average"
)
type
=
"int"
,
default
=
500
,
help
=
"Max Samples for Moving Average"
)
(
cmdOptions
,
args
)
=
cmdParser
.
parse_args
()
...
...
@@ -854,6 +880,12 @@ def Main():
OutputFileName
=
logDir
+
"/logs/SanityCheckDetails.txt"
reportFileName
=
logDir
+
"/logs/SanityCheckReport.txt"
if
not
(
os
.
path
.
exists
(
OutputFileName
)
and
os
.
path
.
exists
(
reportFileName
))
:
#{
print
"##### Error: Path given as input is invalid. Provide the path upto(not including) logs/ directory"
sys
.
exit
()
#}
OutputFileHandle
=
file
(
OutputFileName
,
"w"
)
if
cmdOptions
.
avgMethod
:
...
...
@@ -870,6 +902,9 @@ def Main():
elif
cmdOptions
.
udp
:
transportFlag
=
2
iterator
=
1
else
:
transportFlag
=
2
iterator
=
0
minAvgSamples
=
cmdOptions
.
minAvgSamples
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment