added default values on null values for cpu info (happens with docker

image)
This commit is contained in:
lucio 2024-02-23 10:41:44 +01:00
parent 4fdb69b083
commit dd5d5073ed
1 changed files with 21 additions and 1 deletions

View File

@ -83,10 +83,30 @@ public class ContainerProfileBuilder {
Processor processor = processors.add(); Processor processor = processors.add();
if (map.get("bogomips") != null) processor.bogomips(new BigDecimal(map.get("bogomips"))); if (map.get("bogomips") != null) processor.bogomips(new BigDecimal(map.get("bogomips")));
else processor.bogomips(new BigDecimal(0));
if (map.get("cpu_MHz") != null) processor.clockSpeedMhz(new BigDecimal(map.get("cpu_MHz"))); if (map.get("cpu_MHz") != null) processor.clockSpeedMhz(new BigDecimal(map.get("cpu_MHz")));
processor.family(map.get("cpu_family")).modelName(map.get("model_name")).model(map.get("model")).vendor(map.get("vendor_id")); else processor.clockSpeedMhz(new BigDecimal(0));
if (map.get("cpu_family")!=null)
processor.family(map.get("cpu_family"));
else processor.family(UNKNOWN);
if (map.get("model_name")!=null)
processor.modelName(map.get("model_name"));
else processor.modelName(UNKNOWN);
if (map.get("model")!=null)
processor.model(map.get("model"));
else processor.model(UNKNOWN);
if (map.get("vendor_id")!=null)
processor.vendor(map.get("vendor_id"));
else processor.vendor(UNKNOWN);
if(map.get("cache_size") != null) processor.cacheL1(Integer.parseInt(map.get("cache_size"))); if(map.get("cache_size") != null) processor.cacheL1(Integer.parseInt(map.get("cache_size")));
else processor.cacheL1(0); else processor.cacheL1(0);
processor.cacheL1D(0).cacheL1I(0).cacheL2(0); processor.cacheL1D(0).cacheL1I(0).cacheL2(0);
} }