In "clear" branch  cpu_xml_file used  truncate(0) function that it can make the file detail be empty and no need to 
write()..