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.

Install GuestAddition for Fedora 18/19/20

Install guest additions for Fedora

I encountered this problem:

Unable to mount the CD/DVD image /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso on the machine fedora18. Would you like to force mounting of this medium?
Could not mount the media/drive '/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso' (VERR_PDM_MEDIA_LOCKED).



How did I solve this problem?

Host: Mac 10.7.5
VM: Fedora 18


1.
change to the root user using "su"
2. 
yum install kernel* gcc -y
3.
cd /run/media/haifzhan/VBOXADDITIONS_xxx
4.
./VBoxLinuxAdditions.sh

Done!