Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
basic framework
Browse files Browse the repository at this point in the history
  • Loading branch information
erikfrey committed Aug 8, 2012
1 parent 116a1e4 commit 2acf16c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -8,7 +8,7 @@ cmake_install.cmake
# makefile output
darner
!include/darner
bench_queue_flood
db
test
# sublimetext 2 stuff
*.sublime-project
Expand Down
10 changes: 3 additions & 7 deletions CMakeLists.txt
Expand Up @@ -20,12 +20,8 @@ ADD_EXECUTABLE(darner
src/main
)

ADD_EXECUTABLE(bench_queue_flood
bench/queue_flood
src/queue/iqstream
src/queue/oqstream
src/queue/queue
src/util/log
ADD_EXECUTABLE(db
bench/db
)

ADD_EXECUTABLE(test
Expand All @@ -42,5 +38,5 @@ ADD_EXECUTABLE(test
FIND_PACKAGE(Boost 1.46.1 COMPONENTS thread system program_options unit_test_framework filesystem)

TARGET_LINK_LIBRARIES(darner pthread ${Boost_LIBRARIES} leveldb)
TARGET_LINK_LIBRARIES(bench_queue_flood pthread ${Boost_LIBRARIES} leveldb)
TARGET_LINK_LIBRARIES(db ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(test pthread ${Boost_LIBRARIES} leveldb)
65 changes: 65 additions & 0 deletions bench/db.cpp
@@ -0,0 +1,65 @@
#include <iostream>

#include <boost/thread.hpp>
#include <boost/program_options.hpp>

using namespace std;
using namespace boost;
namespace po = boost::program_options;

int main(int argc, char * argv[])
{
po::options_description generic("Generic options");

size_t port, num_gets, num_sets, workers;

// options only available via command-line
generic.add_options()
("version,v", "prints the version and exits")
("help,h", "produce help message")
("port,p", po::value<size_t>(&port), "port to establish connections")
("gets,g", po::value<size_t>(&num_gets)->default_value(10000), "number of gets to issue")
("sets,s", po::value<size_t>(&num_sets)->default_value(10000), "number of sets to issue")
("concurrency,c", po::value<size_t>(&workers)->default_value(10), "number of concurrent workers");

po::options_description cmdline_options;
cmdline_options.add(generic);

po::variables_map vm;
try
{
po::store(po::command_line_parser(argc, argv).options(cmdline_options).run(), vm);
notify(vm);
}
catch (const po::error & e)
{
cout << "error parsing commandline options: " << e.what() << endl;
cout << cmdline_options << endl;
return 1;
}

if (vm.count("help"))
{
cout << "db: darner bench. performs benchmarks of concurrent gets and sets of a darner server." << endl;
cout << "usage: db -p <port>" << endl;
cout << cmdline_options << endl;
return 0;
}

if (vm.count("version"))
{
cout << DARNER_VERSION << endl;
return 0;
}

if (!vm.count("port"))
{
cout << "please specify a port (-p)" << endl;
cout << "db --help for help" << endl;
return 1;
}

cout << "woohoo" << endl;

return 0;
}
113 changes: 0 additions & 113 deletions bench/queue_flood.cpp

This file was deleted.

0 comments on commit 2acf16c

Please sign in to comment.