wsperf bug fixes

This commit is contained in:
Peter Thorson
2012-03-10 18:39:57 -06:00
parent 4903edbe30
commit 7c1f9d702e
3 changed files with 26 additions and 20 deletions

View File

@@ -57,14 +57,14 @@ using wsperf::case_handler;
* Whether or not to return the full list of round trip times for each message
* primarily useful for debugging.
*/
case_handler::case_handler(wscmd::cmd& cmd) {
m_uri = extract_string(cmd,"uri");
m_token = extract_string(cmd,"token");
m_quantile_count = extract_number<size_t>(cmd,"quantile_count");
m_rtts = extract_bool(cmd,"rtts");
m_bytes = 0;
m_pass = RUNNING;
}
case_handler::case_handler(wscmd::cmd& cmd)
: m_uri(extract_string(cmd,"uri")),
m_token(extract_string(cmd,"token")),
m_quantile_count(extract_number<size_t>(cmd,"quantile_count")),
m_rtts(extract_bool(cmd,"rtts")),
m_pass(RUNNING),
m_timeout(0),
m_bytes(0) {}
/// Starts a test by starting the timeout timer and marking the start time
void case_handler::start(connection_ptr con, uint64_t timeout) {
@@ -74,7 +74,9 @@ void case_handler::start(connection_ptr con, uint64_t timeout) {
boost::posix_time::seconds(0))
);
m_timer->expires_from_now(boost::posix_time::milliseconds(timeout));
m_timeout = timeout;
m_timer->expires_from_now(boost::posix_time::milliseconds(m_timeout));
m_timer->async_wait(
boost::bind(
&type::on_timer,
@@ -109,7 +111,9 @@ void case_handler::end(connection_ptr con) {
double total = 0;
double seconds = 0;
m_timer->cancel();
if (m_timeout > 0) {
m_timer->cancel();
}
// TODO: handle weird sizes and error conditions better
if (m_end.size() > m_quantile_count) {

View File

@@ -119,7 +119,6 @@ protected:
RUNNING = 3
};
std::string m_name;
std::string m_uri;
std::string m_token;
size_t m_quantile_count;
@@ -127,7 +126,9 @@ protected:
std::string m_data;
status m_pass;
boost::shared_ptr<boost::asio::deadline_timer> m_timer;
uint64_t m_timeout;
boost::shared_ptr<boost::asio::deadline_timer> m_timer;
boost::chrono::steady_clock::time_point m_start;
std::vector<boost::chrono::steady_clock::time_point> m_end;

View File

@@ -70,14 +70,15 @@ using wsperf::message_test;
* mode can be used to test situations where you deliberately return incorrect
* bytes in order to compare performance (ex: performance with/without masking)
*/
message_test::message_test(wscmd::cmd& cmd) : case_handler(cmd) {
m_message_count = extract_number<uint64_t>(cmd,"size");
m_message_size = extract_number<uint64_t>(cmd,"count");
m_timeout = extract_number<uint64_t>(cmd,"timeout");
m_binary = extract_bool(cmd,"binary");
m_sync = extract_bool(cmd,"sync");
message_test::message_test(wscmd::cmd& cmd)
: case_handler(cmd),
m_message_size(extract_number<uint64_t>(cmd,"size")),
m_message_count(extract_number<uint64_t>(cmd,"count")),
m_timeout(extract_number<uint64_t>(cmd,"timeout")),
m_binary(extract_bool(cmd,"binary")),
m_sync(extract_bool(cmd,"sync")),
m_acks(0)
{
if (cmd.args["correctness"] == "exact") {
m_mode = EXACT;
} else if (cmd.args["correctness"] == "length") {