mysqli has a couple of functions that will give you some stats:
Some of the statistics available include:
- bytes_sent - Number of bytes sent from PHP to the MySQL server
- bytes_received - Number of bytes received from MySQL server
Take a look at this page to see the all the stats you can get if you're using the MySQL Native Driver: MySQL Native Driver statistics