Skip to content

Commit

Permalink
Support setting memory limit in sort_speed_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortal committed May 28, 2012
1 parent 90609ce commit ec3dbf5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/speed_regression/sort.cpp
Expand Up @@ -39,7 +39,7 @@ typedef uint64_t count_t; // number of items
typedef uint64_t elm_t; // type of element we sort

void usage() {
std::cout << "Parameters: [times] [mb]" << std::endl;
std::cout << "Parameters: [times] [mb] [memory]" << std::endl;
}

void test(size_t mb, size_t times) {
Expand Down Expand Up @@ -104,6 +104,7 @@ void test(size_t mb, size_t times) {
int main(int argc, char **argv) {
size_t times = 10;
size_t mb = mb_default;
size_t memory = 1024;

if (argc > 1) {
if (std::string(argv[1]) == "0") {
Expand All @@ -123,8 +124,15 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
}
}
if (argc > 3) {
std::stringstream(argv[3]) >> memory;
if (!memory) {
usage();
return EXIT_FAILURE;
}
}

testinfo t("Sort speed test", 1024, mb, times);
testinfo t("Sort speed test", memory, mb, times);
::test(mb, times);
return EXIT_SUCCESS;
}

0 comments on commit ec3dbf5

Please sign in to comment.