Skip to content
Snippets Groups Projects
Commit c79f07bf authored by samarth5's avatar samarth5
Browse files

Fixing labels of plots

parent 9f3f356a
No related branches found
No related tags found
No related merge requests found
*.o
*.csv
*.txt
*.png
BenchmarkingModule
\ No newline at end of file
......@@ -48,8 +48,9 @@ int main()
int numberOfItemsToDequeueLarge = 100;
int oneThread = 1;
bool isOnlyEnqueueOperation = true;
int numberOfMeasurements = 100;
int numberOfMeasurements = 10;
int maxThreads = thread::hardware_concurrency();
Benchmark<char*> benchmark;
Operation<char*> enqueueOperation1(make_shared<LockQueue<char*>>(), EnqueueNItems, numberOfItemsToEnqueueSmall, oneThread);
......@@ -74,61 +75,65 @@ int main()
Operation<char*> enqueueDequeueOperation11(make_shared<CharmQueue>(), EnqueueNItems, numberOfItemsToEnqueueSmall, DequeueNItems, numberOfItemsToDequeueLarge, numberOfMicrosecondsToDequeueFor);
Operation<char*> enqueueDequeueOperation4(make_shared<LockQueue<char*>>(), EnqueueNItems, numberOfItemsToEnqueueLarge, DequeueNItems, numberOfItemsToDequeueLarge, numberOfMicrosecondsToDequeueFor);
Operation<char*> enqueueDequeueOperation12(make_shared<CharmQueue>(), EnqueueNItems, numberOfItemsToEnqueueLarge, DequeueNItems, numberOfItemsToDequeueLarge, numberOfMicrosecondsToDequeueFor);
Operation<char*> enqueueDequeueOperation12(make_shared<LockQueue<char*>>(), EnqueueNItems, numberOfItemsToEnqueueLarge, DequeueNItems, numberOfItemsToDequeueLarge, numberOfMicrosecondsToDequeueFor);
ofstream file1;
file1.open("1.txt");
file1<<"##Enqueue: Small number of items and only one thread."<<endl
<<"Index\tMean\t\tSd"<<endl
file1<< "Ne per thread: " << numberOfItemsToEnqueueSmall <<"\tNt: " << 1 <<endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation1, isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation9, isOnlyEnqueueOperation, numberOfMeasurements);
ofstream file2;
file2.open("2.txt");
file2<<"##Enqueue: Large number of items and only one thread."<<endl
<<"Index\tMean\t\tSd"<<endl
file2<< "Ne per thread: " << numberOfItemsToEnqueueLarge <<"\tNt: " << 1 <<endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation2, isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation10, isOnlyEnqueueOperation, numberOfMeasurements);
ofstream file3;
file3.open("3.txt");
file3<<"##Enqueue: Small number of items and one thread per hardware thread."<<endl
<<"Index\tMean\t\tSd"<<endl
file3<< "Ne per thread: " << numberOfItemsToEnqueueSmall <<"\tNt: " << maxThreads <<endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation3, isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation11, isOnlyEnqueueOperation, numberOfMeasurements);
ofstream file4;
file4.open("4.txt");
file4<<"##Enqueue: Large number of items and one thread per hardware thread."<<endl
<<"Index\tMean\t\tSd"<<endl
file4<< "Ne per thread: " << numberOfItemsToEnqueueLarge <<"\tNt: " << maxThreads <<endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation4, isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueOperation12, isOnlyEnqueueOperation, numberOfMeasurements);
ofstream file5;
file5.open("5.txt");
file5<<"##EnqueueDequeue: Small number of items to enqueue, small number of items to dequeue and one thread per hardware thread."<<endl
<<"Index\tMean\t\tSd"<<endl
file5<< "Ne per thread: " << numberOfItemsToEnqueueSmall << "\tNd: " << numberOfItemsToDequeueSmall << "\tNt: " << maxThreads <<"\tDequeueInterval: " << numberOfMicrosecondsToDequeueFor << endl
// file5<<"##EnqueueDequeue: Small number of items to enqueue, small number of items to dequeue and one thread per hardware thread."<<endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation1, !isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation9, !isOnlyEnqueueOperation, numberOfMeasurements);
ofstream file6;
file6.open("6.txt");
file6<<"##EnqueueDequeue: Large number of items to enqueue, small number of items to dequeue and one thread per hardware thread."<<endl
<<"Index\tMean\t\tSd"<<endl
file6<< "Ne per thread: " << numberOfItemsToEnqueueLarge << "\tNd: " << numberOfItemsToDequeueSmall << "\tNt: " << maxThreads <<"\tDequeueInterval: " << numberOfMicrosecondsToDequeueFor << endl
// file6<<"##EnqueueDequeue: Large number of items to enqueue, small number of items to dequeue and one thread per hardware thread."<<endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation2, !isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation10, !isOnlyEnqueueOperation, numberOfMeasurements);
ofstream file7;
file7.open("7.txt");
file7<<"##EnqueueDequeue: Large number of items to enqueue, large number of items to dequeue and one thread per hardware thread."<<endl
<<"Index\tMean\t\tSd"<<endl
file7<< "Ne per thread: " << numberOfItemsToEnqueueSmall << "\tNd: " << numberOfItemsToDequeueLarge << "\tNt: " << maxThreads <<"\tDequeueInterval: " << numberOfMicrosecondsToDequeueFor << endl
// file7<<"##EnqueueDequeue: Large number of items to enqueue, large number of items to dequeue and one thread per hardware thread."<<endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation3, !isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation11, !isOnlyEnqueueOperation, numberOfMeasurements);
ofstream file8;
file8.open("8.txt");
file8<<"##EnqueueDequeue: Large number of items to enqueue, large number of items to dequeue and one thread per hardware thread."<<endl
<<"Index\tMean\t\tSd"<<endl
// file8<<"##EnqueueDequeue: Large number of items to enqueue, large number of items to dequeue and one thread per hardware thread."<<endl
file8<< "Ne per thread: " << numberOfItemsToEnqueueLarge << "\tNd: " << numberOfItemsToDequeueLarge << "\tNt: " << maxThreads <<"\tDequeueInterval: " << numberOfMicrosecondsToDequeueFor << endl
<<"Index\t\tValues"<<endl
<<"1\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation4, !isOnlyEnqueueOperation, numberOfMeasurements)
<<"2\t"<<benchmark.GetBenchmarkMeasure(enqueueDequeueOperation12, !isOnlyEnqueueOperation, numberOfMeasurements);
......@@ -186,5 +191,5 @@ int main()
// cout<<benchmark3.GetBenchmarkMeasure(enqueueDequeueOperation14, false, 5);
// cout<<benchmark3.GetBenchmarkMeasure(enqueueDequeueOperation15, false, 5);
// cout<<benchmark3.GetBenchmarkMeasure(enqueueDequeueOperation16, false, 5);
// cout<<endl;
// cout<<endl;
}
......@@ -7,24 +7,32 @@ f, ax = plt.subplots(4, 2)
ir = 0
jr = 0
titles = []
fileValues = []
for i in range(1,9):
with open(str(i) + ".txt") as fileHandle:
valuesToPlot = []
lines = fileHandle.readlines()[2:]
for line in lines:
lines = fileHandle.readlines()
titles.append(lines[0])
for line in lines[2:]:
details = line.split("\t")
index = int(details[0])
valuesToPlot.append(map(float, details[1].split(",")))
fileValues.append(valuesToPlot)
r = 0
title_font = {'fontname':'Arial', 'size':'8', 'color':'black', 'weight':'normal', 'verticalalignment':'center'}
for fileValue in fileValues:
ax[ir, jr].boxplot(fileValue)
ax[ir, jr].set_title(titles[r].expandtabs(), title_font)
r+=1
ax[ir, jr].set_xticklabels(tickLabels)
jr +=1
if jr >= 2:
ir += 1
jr = 0
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0.2, hspace=0.4)
plt.show()
\ No newline at end of file
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