Adding support for writing function statistics