public Double getProcessorMetric ( String processorNumber , ID metricToCollect ) { CentralProcessor processor = getProcessor ( ) ; if ( processor == null ) { return null ; } int processorIndex ; try { processorIndex = Integer . parseInt ( processorNumber ) ; if ( processorIndex < 0 || processorIndex >= processor . getLogicalProcessorCount ( ) ) { return null ; } } catch ( Exception e ) { return null ; } if ( PlatformMetricType . PROCESSOR_CPU_USAGE . getMetricTypeId ( ) . equals ( metricToCollect ) ) { return processor . getProcessorCpuLoadBetweenTicks ( ) [ processorIndex ] ; } else { throw new UnsupportedOperationException ( "Invalid processor metric to collect: " + metricToCollect ) ; } }
Returns the given metric s value or null if there is no processor with the given number .