mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-04-29 12:14:13 +00:00
Fix sample app histogram sample-application
Improve graph labels and align histogram bars on x-axis labels Add n= value to show it's not a static image. Tracked-On: #8025 Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
This commit is contained in:
parent
03905be20f
commit
11985014f0
@ -40,17 +40,18 @@ def create_hist():
|
|||||||
web_sem.release()
|
web_sem.release()
|
||||||
|
|
||||||
#Transform the data into an array that matplotlib can understand
|
#Transform the data into an array that matplotlib can understand
|
||||||
dataset = transform_data(data)
|
count, dataset = transform_data(data)
|
||||||
|
|
||||||
#Clear the figure and recreate from the new data
|
#Clear the figure and recreate from the new data
|
||||||
plt.clf()
|
plt.clf()
|
||||||
|
|
||||||
#Setup the figure and save it
|
#Setup the figure and save it
|
||||||
figure = plt.hist(dataset)
|
bins=np.arange(min(dataset),max(dataset)+2)-0.5
|
||||||
|
figure = plt.hist(dataset,bins,rwidth=0.5)
|
||||||
|
|
||||||
plt.title("Latency percentages")
|
plt.title("ACRN Sample Application cyclictest display (unoptimized)")
|
||||||
plt.xlabel("Latency Value (us)")
|
plt.xlabel("Latency Value (microseconds)")
|
||||||
plt.ylabel("Frequency")
|
plt.ylabel("Count Percentage " + f"{count:,}")
|
||||||
plt.savefig("hist.png")
|
plt.savefig("hist.png")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
@ -77,7 +78,7 @@ def transform_data(data_string):
|
|||||||
for i in range(0, int(len(data_percentages) / 2)):
|
for i in range(0, int(len(data_percentages) / 2)):
|
||||||
transformed_data_values += ([int(data_percentages[i*2])] * int(data_percentages[i*2 + 1]))
|
transformed_data_values += ([int(data_percentages[i*2])] * int(data_percentages[i*2 + 1]))
|
||||||
|
|
||||||
return transformed_data_values
|
return int(total_count), transformed_data_values
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user