Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102853681
cdf-gen.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 24, 21:18
Size
944 B
Mime Type
text/x-python
Expires
Wed, Feb 26, 21:18 (2 d)
Engine
blob
Format
Raw Data
Handle
24441777
Attached To
R3704 elastic-yarn
cdf-gen.py
View Options
#!/usr/bin/python
# I don't think this works if columns are of different sizes
#and smaller columns are in between larger ones
import
sys
import
string
import
os
if
len
(
sys
.
argv
)
!=
3
:
print
"Usage: ./cdf-gen.py INUPT_FILENAME COLUMN_NR_STARTING_FROM_0"
exit
(
1
)
filename
=
sys
.
argv
[
1
]
column
=
int
(
sys
.
argv
[
2
])
fd
=
open
(
filename
,
'rb'
)
responseTimes
=
[]
for
line
in
fd
.
readlines
():
if
len
(
line
.
strip
()):
try
:
responseTimes
.
append
(
float
(
string
.
split
(
line
)[
column
]))
except
:
print
>>
sys
.
stderr
,
"cdf-gen.py error reading "
,
filename
,
" at line: "
,
len
(
responseTimes
)
responseTimes
.
sort
()
total_traffic
=
0
for
time
in
responseTimes
:
total_traffic
+=
time
prob
=
0
for
time
in
responseTimes
:
prob
+=
1.0
/
len
(
responseTimes
)
# prob += time *1.0 / total_traffic
print
"
%.4f
\t
%.4f
"
%
(
prob
*
100
,
time
)
Event Timeline
Log In to Comment