Fetches the CPU Energy Deltas by fetching values from RAPL files
(self, duration: Time)
| 823 | self._create_rapl_files(domain_map, found_main_readable) |
| 824 | |
| 825 | def get_cpu_details(self, duration: Time) -> Dict: |
| 826 | """ |
| 827 | Fetches the CPU Energy Deltas by fetching values from RAPL files |
| 828 | """ |
| 829 | cpu_details = {} |
| 830 | try: |
| 831 | for rapl_file in self._rapl_files: |
| 832 | rapl_file.delta(duration) |
| 833 | |
| 834 | for rapl_file in self._rapl_files: |
| 835 | logger.debug(rapl_file) |
| 836 | cpu_details[rapl_file.name] = rapl_file.energy_delta.kWh |
| 837 | # We fake the name used by Power Gadget when using RAPL |
| 838 | if "Energy" in rapl_file.name: |
| 839 | cpu_details[rapl_file.name.replace("Energy", "Power")] = ( |
| 840 | rapl_file.power.W |
| 841 | ) |
| 842 | except Exception as e: |
| 843 | logger.info( |
| 844 | "\tRAPL - Unable to read Intel RAPL files at %s\n \ |
| 845 | Exception occurred %s", |
| 846 | self._rapl_files, |
| 847 | e, |
| 848 | exc_info=True, |
| 849 | ) |
| 850 | self._cpu_details = cpu_details |
| 851 | logger.debug("get_cpu_details %s", self._cpu_details) |
| 852 | return cpu_details |
| 853 | |
| 854 | def get_static_cpu_details(self) -> Dict: |
| 855 | """ |