Wednesday, March 20, 2013

Perf4j for TPS(transactions per second)

How to use Perf4j with Slf4j ?


I used to use the following code for counting TPS

long start = System.currentTimeMillis();

long timeTook = System.currentTimeMillis() - start;
System.out.println("Time took(milliseconds):  " + timeTook);
System.out.println("Successful output #: " + counter);
System.out.println("Average TPS: " + counter * 1000 / timeTook);

Actually it is not a good way to record TPS.

Now I will introduce a new way to counting TPS, it is Perf4j, it can be used both for log4j and slf4j,
log4j is the way which the perf4 offical website introduced.Now I will introduce how to use Perf4j with slf4j.
Please take a glance at my github repo for perf4j.

It is very easy to use, convenient to use, hope it helps.

No comments:

Post a Comment