Skip to content
Snippets Groups Projects
Commit 5cc917fb authored by hang's avatar hang
Browse files

graph part done

parent 5393d79d
No related branches found
No related tags found
No related merge requests found
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()
......@@ -2,4 +2,5 @@ matplotlib
numpy
psutil
pre-commit
pandas
pillow
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment