Mining with the wallet, per the code in the OP - how can i check to see if it is actually mining?
type to console: gethashespersec
you will see it returns you 0h/s
It will return 0h/s if you are not mining......if you are mining correctly your wallet "gethashpersec" command will retrieve you the actual hashing speed of your machine.