Remove duplication, add typing, allow more functionality in userbenchmark utils (#1579)
Summary:
This PR originated from wanting to expand dump_output to accept various target directories in which to dump output. I just went along and added typing for clarity + refactored duplicated code in the meantime.
The typing should allow easier understanding/usage of the functions
Pull Request resolved: https://github.com/pytorch/benchmark/pull/1579
Reviewed By: xuzhao9
Differential Revision: D45314066
Pulled By: janeyx99
fbshipit-source-id: 42bdd0959fb8882e4c922263e670f96ad13e9f1b