public Object[] getElements(Object input) { LongEnumer keys = xlogMap.keys(); ArrayList<XLogConnection> list = new ArrayList<XLogConnection>(); LongKeyMap<Integer> countMap = new LongKeyMap<Integer>(); while (keys.hasMoreElements()) { long key = keys.nextLong(); XLogData d = xlogMap.get(key); long caller = d.p.caller; Integer cntInt = countMap.get(caller); if (cntInt == null) { cntInt = new Integer(1); countMap.put(caller, cntInt); } else { cntInt = new Integer(cntInt.intValue() + 1); countMap.put(caller, cntInt); } XLogConnection conn = new XLogConnection(caller, d); String serviceName = TextProxy.service.getLoadText(DateUtil.yyyymmdd(d.p.endTime), d.p.service, d.serverId); conn.name = "(" + cntInt.intValue() + ") " + serviceName.substring(serviceName.lastIndexOf("/"), serviceName.length()); conn.elapsed = d.p.elapsed; conn.error = d.p.error != 0; list.add(conn); } return list.toArray(); }
private void toArray(LongKeyMap<Step> src, List<Step> out) { if (src == null) return; Enumeration<Step> en = src.values(); for (int i = 0, max = src.size(); i < max; i++) { out.add(en.nextElement()); } src.clear(); }
protected void add(SocketStep m) { if (sockets == null) sockets = new LongKeyMap<Step>(); long skid = m.getSocketId(); SocketSum sksum = (SocketSum) sockets.get(skid); if (sksum != null) { sksum.add(m.elapsed, sksum.error != 0); return; } if (totalCount >= BUFFER_SIZE) { process(); } sksum = new SocketSum(); sksum.ipaddr = m.ipaddr; sksum.port = m.port; sksum.add(m.elapsed, sksum.error != 0); sockets.put(skid, sksum); totalCount++; }