@Override public boolean CheckTransactionalRule(MachinePerformanceData req, List<NameValuePair> params, AtomicReference<String> nullableFaultMsg) { if (nullableFaultMsg == null) { nullableFaultMsg = new AtomicReference<String>(); } if (req.getPercentusedCPU() == null) { return false; } NameValuePair GetNameValuePairByName = Utility.getNameValuePairByName(params, "value"); long rate = -1; if (GetNameValuePairByName.isEncrypted()) { rate = Long.parseLong(Utility.DE(GetNameValuePairByName.getValue())); } else { rate = Long.parseLong(GetNameValuePairByName.getValue()); } long faultrate = req.getPercentusedCPU().longValue(); if (faultrate < rate) { nullableFaultMsg.set("The measured CPU Usage of " + faultrate + " is higher than " + rate + ", " + nullableFaultMsg.get()); return true; } return false; }
public Object produceDataset(Map params) throws DatasetProduceException { TimeSeriesCollection col = new TimeSeriesCollection(); try { //Logger.getAnonymousLogger().log(Level.INFO, "fgsmsWEB debug, size" + params.size()); GetMachinePerformanceLogsByRangeResponseMsg res = (GetMachinePerformanceLogsByRangeResponseMsg) params.get("fgsms.data"); if (res != null && res.getMachinePerformanceData() != null && !res.getMachinePerformanceData().isEmpty()) { TimeSeries s = new TimeSeries("CPU %", org.jfree.data.time.Millisecond.class); for (int i = 0; i < res.getMachinePerformanceData().size(); i++) { Millisecond m = new Millisecond(res.getMachinePerformanceData().get(i).getTimestamp().getTime()); // TimeSeriesDataItem t = new TimeSeriesDataItem(m, // recordset.stuff.get(i).data.get(k).ResponseTime); // s.add(t); if (res.getMachinePerformanceData().get(i).getPercentusedCPU()!=null) s.addOrUpdate(m, res.getMachinePerformanceData().get(i).getPercentusedCPU()); } col.addSeries(s); } } catch (Exception ex) { LogHelper.getLog().log(Level.ERROR, "ProcessPerfLogsOverTime produce chart data " + ex.getLocalizedMessage()); } return col; }
if (req.getMachineData().getPercentusedCPU() == null) { com.setNull(3, java.sql.Types.INTEGER); } else { com.setLong(3, req.getMachineData().getPercentusedCPU().intValue());