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

Commit

Permalink
track enqueued and dequeued stat
Browse files Browse the repository at this point in the history
  • Loading branch information
erikfrey committed Aug 13, 2012
1 parent b42fea7 commit 753191c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/darner/util/stats.hpp
Expand Up @@ -31,7 +31,7 @@ struct stats
out << "STAT uptime " << (now - alive_since).total_seconds() << "\r\n";
out << "STAT time " << (now - epoch).total_seconds() << "\r\n";
out << "STAT version " << DARNER_VERSION << "\r\n";
out << "STAT curr_items " << items_dequeued - items_enqueued << "\r\n";
out << "STAT curr_items " << (items_enqueued > items_dequeued ? items_enqueued - items_dequeued : 0) << "\r\n";
out << "STAT total_items " << items_enqueued << "\r\n";
out << "STAT curr_connections " << conns_opened - conns_closed << "\r\n";
out << "STAT total_connections " << conns_opened << "\r\n";
Expand Down
2 changes: 2 additions & 0 deletions src/net/handler.cpp
Expand Up @@ -157,6 +157,7 @@ void handler::set_on_read_chunk(const system::error_code& e, size_t bytes_transf
if (push_stream_->tell() == req_.num_bytes) // are we all done?
{
push_stream_.reset();
++stats_.items_enqueued;
return done(true, "STORED\r\n");
}

Expand Down Expand Up @@ -269,6 +270,7 @@ void handler::get_on_write_chunk(const boost::system::error_code& e, size_t byte
}
pop_stream_.reset();
}
++stats_.items_dequeued;
return done(true, "\r\nEND\r\n");
}
else
Expand Down

0 comments on commit 753191c

Please sign in to comment.