Ping does not measure throughput and anything that you do using minimal amounts of data (e.g. you might consider using HTTP Get/Post to estimate downlink/uplink throughput if you can time those transactions and know the transfer byte counts). However such an approach would be totally flawed - don't waste your time on this.
As Richard MaxCutchan has said you have to transfer data, and if the estimate is to be of any use you're going to need to transfer a "reasonable" amount. How much is reasonable? Well, the more data you transfer the better you average over the variable throughput that's achieved on ALL packet data networks (including the internet). This is why you'll see the throughput estimates on sites like speedtest.net fluctuate wildly at the start of the test, then stabilise to a longer-term average.
Remember also that there's latency to consider. That is, a delay between your request to trigger an upload/download and the transfer actually beginning. If your test uses large byte counts then you may be able to ignore that time delay, otherwise you need to carefully eliminate it from the throughput time.
There is a very good tool called iPerf (and a companion tool jPerf which is iPerf with a GUI) that can be used for throughput measurement. iPerf allows you to setup a server anywhere on your network that will pump-out data bytes (for download test) or sink bytes (for upload test), with whatever device you wanted connected as a client and doing the downloads/uploads. iPerf logs contain all that you should need. More here
and in plenty more can easily be found.