Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs425_distributed_system_mp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hangxie2
cs425_distributed_system_mp
Commits
5cc917fb
Commit
5cc917fb
authored
3 years ago
by
hang
Browse files
Options
Downloads
Patches
Plain Diff
graph part done
parent
5393d79d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mp1/graph_generator.py
+41
-0
41 additions, 0 deletions
mp1/graph_generator.py
requirements.txt
+2
-1
2 additions, 1 deletion
requirements.txt
with
43 additions
and
1 deletion
mp1/graph_generator.py
0 → 100644
+
41
−
0
View file @
5cc917fb
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
pandas
as
pd
def
parse_log
(
line
:
str
):
pass
def
generate_records_for_node
():
"""
The key metric we will track in this MP is the “transaction processing time”,
measured as the time difference between when a transaction is generated at a node,
and when it is processed by the last node in the system.
You need to plot the CDF (cumulative distribution function) of transaction processing time.
A datapoint (X,Y) on the CDF indicates that the Y%ile value of the metric is X. Your y-axis must range from 1-99%ile.
nodeid generated_time processed_time transaction_str
log example:
"""
with
open
(
'
./node.log
'
,
'
r
'
)
as
file
:
for
line
in
file
:
generated_time
,
processed_time
,
transaction_str
=
line
.
split
(
"
"
)
pass
def
draw_graph
():
step
=
0.05
indices
=
np
.
arange
(
0
,
1
+
step
,
step
)
time_processed_per_msg
=
[
1
,
2
,
2
,
3
,
4
]
cdf
=
pd
.
DataFrame
({
'
dummy
'
:
time_processed_per_msg
})[
'
dummy
'
].
quantile
(
indices
)
plt
.
plot
(
cdf
,
indices
,
linewidth
=
9
,
label
=
'
processed time
'
,
color
=
'
blue
'
)
plt
.
savefig
(
'
./graph.png
'
)
if
__name__
==
'
__main__
'
:
# generate_records_for_node()
draw_graph
()
This diff is collapsed.
Click to expand it.
requirements.txt
+
2
−
1
View file @
5cc917fb
...
...
@@ -2,4 +2,5 @@ matplotlib
numpy
psutil
pre-commit
pandas
pillow
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment