performance test finish
parent
df047379b6
commit
6d184490eb
@ -1,64 +1,66 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import orjson
|
||||
|
||||
|
||||
fig = plt.figure(1)
|
||||
plt.subplot(421) # 設定子圖 421 表示4*2 位置1 不想塞子圖就註解
|
||||
duration_info_message = 8
|
||||
duration_info_message_bin = 4
|
||||
def readData(fileName:str) -> dict:
|
||||
with open(fileName, "r") as f:
|
||||
data_dict = orjson.loads(f.read())
|
||||
return data_dict
|
||||
|
||||
width=0.3
|
||||
x = ['set1']
|
||||
x1=np.arange(len(x)) #X 軸 (第一組)
|
||||
y1=(8) #Y 軸1=duration_info_message
|
||||
x2=[p + width for p in x1] #X 軸 (第二組)
|
||||
y2=(4) #Y 軸2=duration_info_message_bin
|
||||
plt.bar(x1, y1, label='Json', width=0.1) #繪製長條圖
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1) #繪製長條圖
|
||||
plt.xticks([p + width/2 for p in x1], x) #設定 X 軸刻度標籤
|
||||
plt.legend() #顯示圖例
|
||||
plt.title('duration_info') #設定圖形標題
|
||||
# plt.xlabel('x label') #設定 X 軸標籤
|
||||
plt.ylabel('MB') #設定 Y 軸標籤
|
||||
|
||||
|
||||
|
||||
plt.subplot(422)
|
||||
flight_info_message=85
|
||||
flight_info_message_bin=22
|
||||
width=0.3
|
||||
x = ['set2']
|
||||
x1=np.arange(len(x)) #X 軸 (第一組)
|
||||
y1=(85) #Y 軸1=duration_info_message
|
||||
x2=[p + width for p in x1] #X 軸 (第二組)
|
||||
y2=(22) #Y 軸2=duration_info_message_bin
|
||||
plt.bar(x1, y1, label='Json', width=0.1) #繪製長條圖
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1) #繪製長條圖
|
||||
plt.xticks([p + width/2 for p in x1], x) #設定 X 軸刻度標籤
|
||||
plt.legend() #顯示圖例
|
||||
plt.title('flight_info') #設定圖形標題
|
||||
# plt.xlabel('x label') #設定 X 軸標籤
|
||||
plt.ylabel('MB') #設定 Y 軸標籤
|
||||
|
||||
def plotSizeHist(size_data_dict:dict):
|
||||
postion = 421
|
||||
for OutterKey in size_data_dict:
|
||||
plt.subplot(postion)
|
||||
plt.ylim(top=140)
|
||||
postion += 1
|
||||
size = list(size_data_dict[OutterKey].values())
|
||||
width=0.3
|
||||
x = ['']
|
||||
x1=np.arange(len(x))
|
||||
y1=(size[0])
|
||||
x2=[p + width for p in x1]
|
||||
y2=(size[1])
|
||||
plt.bar(x1, y1, label='Json', width=0.1)
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1)
|
||||
plt.xticks([p + width/2 for p in x1], x)
|
||||
plt.legend()
|
||||
plt.title(OutterKey)
|
||||
plt.ylabel('MB')
|
||||
figure = plt.gcf() # get current figure
|
||||
figure.set_size_inches(18, 14)
|
||||
plt.savefig("performancePlot/size.png")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
fig = plt.figure(2)
|
||||
def plotTimeHist(time_data_dict:dict):
|
||||
postion = 211
|
||||
for OutterKey in time_data_dict:
|
||||
plt.subplot(postion)
|
||||
postion += 1
|
||||
size = list(time_data_dict[OutterKey].values())
|
||||
width=0.3
|
||||
x = ['']
|
||||
x1=np.arange(len(x))
|
||||
y1=(size[0])
|
||||
x2=[p + width for p in x1]
|
||||
y2=(size[1])
|
||||
plt.bar(x1, y1, label='Json', width=0.1)
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1)
|
||||
plt.xticks([p + width/2 for p in x1], x)
|
||||
plt.legend()
|
||||
plt.title(OutterKey)
|
||||
plt.ylabel('second')
|
||||
|
||||
plt.savefig("performancePlot/time.png")
|
||||
plt.show()
|
||||
|
||||
json=404
|
||||
serial=97
|
||||
width=0.3
|
||||
x = ['set']
|
||||
x1=np.arange(len(x)) #X 軸 (第一組)
|
||||
y1=(404) #Y 軸1=duration_info_message
|
||||
x2=[p + width for p in x1] #X 軸 (第二組)
|
||||
y2=(97) #Y 軸2=duration_info_message_bin
|
||||
plt.bar(x1, y1, label='Json', width=0.1) #繪製長條圖
|
||||
plt.bar(x2, y2, label='protobuf', width=0.1) #繪製長條圖
|
||||
plt.xticks([p + width/2 for p in x1], x) #設定 X 軸刻度標籤
|
||||
plt.legend() #顯示圖例
|
||||
plt.title('flight_info') #設定圖形標題
|
||||
# plt.xlabel('x label') #設定 X 軸標籤
|
||||
plt.ylabel('MB') #設定 Y 軸標籤
|
||||
|
||||
|
||||
plt.show()
|
||||
if __name__ == "__main__":
|
||||
fileName_size, fileName_time = "Data/sizeData", "Data/timeData"
|
||||
plotSizeHist(readData(fileName_size))
|
||||
plotTimeHist(readData(fileName_time))
|
||||
@ -0,0 +1 @@
|
||||
{"flight_info_message":{"json":85,"proto":22},"fly_format_message":{"json":55,"proto":7},"imu_info_message":{"json":130,"proto":34},"odom_info_message":{"json":59,"proto":17},"flymode_info_message":{"json":38,"proto":2},"duration_info_message":{"json":8,"proto":4},"timestamp_info_message":{"json":29,"proto":11},"Total":{"json":404,"proto":97}}
|
||||
@ -0,0 +1 @@
|
||||
{"serialize":{"json":0.710234867001418,"proto":2.2478437370155007},"deserializ":{"json":0.41798062800080515,"proto":0.49253950000274926}}
|
||||
@ -0,0 +1 @@
|
||||
"2022-12-08T16:44:17.067479Z"
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
"2022-12-08T07:22:43.602554Z"
|
||||
Loading…
Reference in New Issue