def get_info_dict()

in analysis/GreenSKU-Framework/src/carbon_model.py [0:0]


    def get_info_dict(self) -> Dict[str, Any]:
        """Get the information about the server as a dictionary."""
        info = {}

        # add per-socket capacities
        for component in self.capacities:
            info[f'{component}_capacity'] = self.capacities[component]

        info['socket_count'] = self.socket_count
        info['server_count'] = self.server_count
        info['sellable_core_count'] = self.sellable_cores
        info['constrained_by'] = "power" if self.power_limited else "space"

        provisioned, allocated = self.get_server_power()
        info['server_design_power'] = provisioned
        info['server_allocated_power'] = allocated
        
        # add rack-level component operational, embodied, and carbon
        for component in self.component_rack_operational:
            info[f'{component}_operational'] = self.component_rack_operational[component]
            info[f'{component}_embodied'] = self.component_rack_embodied[component]
            info[f'{component}_carbon'] = self.component_rack_carbon[component]

            info[f'{component}_operational_perc'] = self.component_rack_operational[component] * 100 / self.rack_operational
            info[f'{component}_embodied_perc'] = self.component_rack_embodied[component] * 100 / self.rack_embodied
            info[f'{component}_carbon_perc'] = self.component_rack_carbon[component] * 100 / self.rack_carbon

        # add rack total operational and embodied carbon
        info['total_rack_operational'] = self.rack_operational
        info['total_rack_embodied'] = self.rack_embodied
        info['total_rack_carbon'] = self.rack_carbon

        # add per-sellable rack-level carbon
        info['carbon_per_sellable_core'] = self.get_carbon_per_sellable_core()

        # round all floats to 2 decimal places
        for key in info:
            if isinstance(info[key], float):
                info[key] = round(info[key], 2)
        
        return info