Threading test added

This commit is contained in:
2019-06-30 00:28:08 +02:00
parent cd23cd4f70
commit 2f5d5ece47
5 changed files with 44 additions and 10 deletions
+25 -1
View File
@@ -253,6 +253,30 @@ void DescriptorManager::runExperiments() {
}
}
//Test post please ignore
void DescriptorManager::test() {
const uint64_t n = 1000000000;
//string insert = "constant"; //assuming string value doesn't matter.
int method = 2;
{
high_resolution_clock::time_point t1 = high_resolution_clock::now();
int target_distance = 5;
uint64_t better_count = 0;
map<string, uint64_t>::iterator it = features[method].begin();
for (uint64_t i = 0; i < n; i++) {
uint64_t a = (it++->second);
uint64_t b = (it++->second);
if(descriptor_types[method]->distance(a, b) <= target_distance) better_count++;
if(it == features[method].end()) it = features[method].begin();
}
high_resolution_clock::time_point t2 = high_resolution_clock::now();
duration<double> time_span = duration_cast<duration<double>>(t2 - t1);
cout << "It took me " << time_span.count() << " seconds to sort " << n << " big numbers." << endl;
}
}
//outputs the gathered data to iostream
//Tries to do some nice formatting and grouping of bits.
void DescriptorManager::outputMap(int a) {
@@ -300,4 +324,4 @@ void DescriptorManager::generatePreviews(string imagename) {
for (int i = 0; i < numDescriptors; i++) {
descriptor_types[i]->preview(img);
}
}
}