Move iotrace to a library