コード例 #1
0
 public void setInput(long stime, long etime) {
   this.stime = stime;
   this.etime = etime;
   try {
     setViewTab(objType, counter1, serverId);
     Server server = ServerManager.getInstance().getServer(serverId);
     CounterEngine ce = server.getCounterEngine();
     String counterName = ce.getCounterDisplayName(objType, counter1);
     desc =
         "ⓢ"
             + server.getName()
             + " | (Past All) "
             + counterName
             + "("
             + ce.getCounterUnit(objType, counter1)
             + ") "
             + DateUtil.format(stime, "yyyyMMdd HH:mm:ss")
             + " ~ "
             + DateUtil.format(etime, "HH:mm:ss");
     this.xyGraph.primaryXAxis.setRange(stime, etime);
   } catch (Exception e1) {
     e1.printStackTrace();
   }
   Set<Integer> keySet = dataMap.keySet();
   for (Integer key : keySet) {
     TracePair tp = dataMap.get(key);
     xyGraph.removeTrace(tp.totalTrace);
     xyGraph.removeTrace(tp.activeTrace);
   }
   dataMap.clear();
   load();
 }
コード例 #2
0
  private void load() {
    CounterEngine counterEngine =
        ServerManager.getInstance().getServer(serverId).getCounterEngine();
    new Job("Load " + counterEngine.getCounterDisplayName(objType, counter1)) {
      protected IStatus run(IProgressMonitor monitor) {
        final Map<Integer, MapPack> valueMap1 = new HashMap<Integer, MapPack>();
        final Map<Integer, MapPack> valueMap2 = new HashMap<Integer, MapPack>();
        TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
        try {
          MapPack param = new MapPack();
          param.put("stime", stime);
          param.put("etime", etime);
          param.put("objType", objType);
          param.put("counter", counter1);

          tcp.process(
              RequestCmd.COUNTER_PAST_TIME_ALL,
              param,
              new INetReader() {
                public void process(DataInputX in) throws IOException {
                  MapPack mpack = (MapPack) in.readPack();
                  int objHash = mpack.getInt("objHash");
                  valueMap1.put(objHash, mpack);
                };
              });

          param.put("counter", counter2);

          tcp.process(
              RequestCmd.COUNTER_PAST_TIME_ALL,
              param,
              new INetReader() {
                public void process(DataInputX in) throws IOException {
                  MapPack mpack = (MapPack) in.readPack();
                  int objHash = mpack.getInt("objHash");
                  valueMap2.put(objHash, mpack);
                };
              });

        } catch (Throwable t) {
          ConsoleProxy.errorSafe(t.toString());
        } finally {
          TcpProxy.putTcpProxy(tcp);
        }

        ExUtil.exec(
            canvas,
            new Runnable() {
              public void run() {
                double max = 0;
                for (MapPack mpack : valueMap1.values()) {
                  try {
                    int objHash = mpack.getInt("objHash");
                    ListValue time = mpack.getList("time");
                    ListValue value1 = mpack.getList("value");
                    ListValue value2 = valueMap2.get(objHash).getList("value");

                    TracePair tp =
                        getTracePair(
                            objType,
                            objHash,
                            (int) ((etime - stime) / (DateUtil.MILLIS_PER_SECOND * 2)));
                    CircularBufferDataProvider maxProvider =
                        (CircularBufferDataProvider) tp.totalTrace.getDataProvider();
                    CircularBufferDataProvider valueProvider =
                        (CircularBufferDataProvider) tp.activeTrace.getDataProvider();
                    maxProvider.clearTrace();
                    valueProvider.clearTrace();
                    for (int i = 0; time != null && i < time.size(); i++) {
                      long x = time.getLong(i);
                      maxProvider.addSample(new Sample(x, CastUtil.cdouble(value1.get(i))));
                      valueProvider.addSample(new Sample(x, CastUtil.cdouble(value2.get(i))));
                    }
                    max = Math.max(ChartUtil.getMax(maxProvider.iterator()), max);
                  } catch (Throwable th) {
                  }
                }
                if (CounterUtil.isPercentValue(objType, counter1)) {
                  xyGraph.primaryYAxis.setRange(0, 100);
                } else {
                  xyGraph.primaryYAxis.setRange(0, max);
                }
                redraw();
              }
            });

        return Status.OK_STATUS;
      }
    }.schedule();
  }