Use thread to handle read/write event.
Calculate cost time.