Skip to content

Commit

Permalink
add log-bench.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
yedongfu committed Aug 2, 2014
1 parent 1a3b09e commit 40ab057
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/log-bench.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "handy.h"
#include "conf.h"
#include "logging.h"
#include "daemon.h"

using namespace std;
using namespace handy;


int main(int argc, const char* argv[]) {
Logger::getLogger().setFileName("/dev/null");
//Logger::getLogger().setRotateInterval(60);
time_t last = time(NULL);
long cn = 0, lastcn = 0;
for(;;) {
for (int i = 0; i< 1000; i++) {
info("msgid %ld", ++cn);
//info("msg"); cn++;
}
time_t cur = time(NULL);
if (cur != last) {
last = cur;
printf("log qps %ld\n", (cn - lastcn));
lastcn = cn;
}
}
}

0 comments on commit 40ab057

Please sign in to comment.