Refactor logic to handle cpu, network and memory statistic files