MCPcopy Create free account
hub / github.com/mlco2/codecarbon / get_cpu_details

Method get_cpu_details

codecarbon/core/cpu.py:361–384  ·  view source on GitHub ↗

Fetches the CPU Power Details by fetching values from a logged csv file in _log_values function

(self)

Source from the content-addressed store, hash-verified

359 )
360
361 def get_cpu_details(self) -> Dict:
362 """
363 Fetches the CPU Power Details by fetching values from a logged csv file
364 in _log_values function
365 """
366 self._log_values()
367 cpu_details = {}
368 try:
369 cpu_data = pd.read_csv(self._log_file_path).dropna()
370 for col_name in cpu_data.columns:
371 if col_name in ["System Time", "Elapsed Time (sec)", "RDTSC"]:
372 continue
373 if "Cumulative" in col_name:
374 cpu_details[col_name] = cpu_data[col_name].iloc[-1]
375 else:
376 cpu_details[col_name] = cpu_data[col_name].mean()
377 except Exception as e:
378 logger.info(
379 f"Unable to read Intel Power Gadget logged file at {self._log_file_path}\n \
380 Exception occurred %s",
381 e,
382 exc_info=True,
383 )
384 return cpu_details
385
386 def start(self) -> None:
387 """

Calls 1

_log_valuesMethod · 0.95