Skip to content

Commit

Permalink
Add performance monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
russell-lundberg committed Jan 19, 2024
1 parent 2f8a8b8 commit 17ca319
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Binary file modified bin/main
Binary file not shown.
Binary file modified obj/main.o
Binary file not shown.
19 changes: 10 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <utility>
#include <set>
#include "options.hpp"
#include <chrono>

// comparison function to sort the valid words by score
/*
Expand All @@ -24,12 +25,13 @@ struct comp {
}
};
*/

auto start = std::chrono::system_clock::now();


int main(int argc, char *argv[])
//int main(int argc, std::string* argv)
{

std::unordered_map<std::string,std::string> Options = {};

// ingest_args() returns an unordered map of command line args and values
Expand Down Expand Up @@ -88,20 +90,19 @@ int main(int argc, char *argv[])

std::cout << "there are " << valid_words.size() << " valid words.\n";

// test for a regex filter
/*
if (Options["regex"]) {
// there is a regex option
std::cout << "main(): regex option value: " << Options["regex"] << ".\n";
}
*/

/*
// display the inputted command line, for reference
std::cout << "You entered: ";
for ( int i = 0 ; i<= argc ; i++ ) {
std::cout << argv[i] << " ";
}
std::cout << "\nEnd.\n";
*/

auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
float formatted = float( elapsed.count() ) / 1000.0;
std::printf("Elapsed time: %2.3f\n", formatted );

return 0;
}

0 comments on commit 17ca319

Please sign in to comment.