use of io.mycat.statistic.stat.UserSqlRWStat in project Mycat-Server by MyCATApache.
the class ShowSQLSumUser method getRow.
private static RowDataPacket getRow(UserStat userStat, long idx, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(idx));
if (userStat == null) {
row.add(StringUtil.encode(("not fond"), charset));
return row;
}
String user = userStat.getUser();
UserSqlRWStat rwStat = userStat.getRWStat();
long R = rwStat.getRCount();
long W = rwStat.getWCount();
String __R = decimalFormat.format(1.0D * R / (R + W));
int MAX = rwStat.getConcurrentMax();
row.add(StringUtil.encode(user, charset));
row.add(LongUtil.toBytes(R));
row.add(LongUtil.toBytes(W));
row.add(StringUtil.encode(String.valueOf(__R), charset));
row.add(StringUtil.encode(String.valueOf(MAX), charset));
row.add(LongUtil.toBytes(rwStat.getNetInBytes()));
row.add(LongUtil.toBytes(rwStat.getNetOutBytes()));
row.add(StringUtil.encode(rwStat.getExecuteHistogram().toString(), charset));
row.add(StringUtil.encode(rwStat.getTimeHistogram().toString(), charset));
row.add(LongUtil.toBytes(rwStat.getLastExecuteTime()));
return row;
}
Aggregations