How to measure current iPhone battery consumption?

I want to measure current battery consumption and show it in the view.