New method to measure entropy production on the nanoscale