use of org.apache.accumulo.core.util.Stat in project accumulo by apache.
the class IMMLGBenchmark method addStat.
private static void addStat(Map<String, Stat> stats, String s, long wt) {
System.out.println(s + ":" + wt);
if (stats == null)
return;
Stat stat = stats.get(s);
if (stat == null) {
stat = new Stat();
stats.put(s, stat);
}
stat.addStat(wt);
}
use of org.apache.accumulo.core.util.Stat in project accumulo by apache.
the class CollectTabletStats method calcTabletStats.
private static void calcTabletStats(Connector conn, String table, Authorizations auths, int batchSize, KeyExtent ke, String[] columns) throws Exception {
try (Scanner scanner = conn.createScanner(table, auths)) {
scanner.setBatchSize(batchSize);
scanner.setRange(new Range(ke.getPrevEndRow(), false, ke.getEndRow(), true));
for (String c : columns) {
scanner.fetchColumnFamily(new Text(c));
}
Stat rowLen = new Stat();
Stat cfLen = new Stat();
Stat cqLen = new Stat();
Stat cvLen = new Stat();
Stat valLen = new Stat();
Stat colsPerRow = new Stat();
Text lastRow = null;
int colsPerRowCount = 0;
for (Entry<Key, Value> entry : scanner) {
Key key = entry.getKey();
Text row = key.getRow();
if (lastRow == null) {
lastRow = row;
}
if (!lastRow.equals(row)) {
colsPerRow.addStat(colsPerRowCount);
lastRow = row;
colsPerRowCount = 0;
}
colsPerRowCount++;
rowLen.addStat(row.getLength());
cfLen.addStat(key.getColumnFamilyData().length());
cqLen.addStat(key.getColumnQualifierData().length());
cvLen.addStat(key.getColumnVisibilityData().length());
valLen.addStat(entry.getValue().get().length);
}
synchronized (System.out) {
System.out.println("");
System.out.println("\tTablet " + ke.getUUID() + " statistics : ");
printStat("Row length", rowLen);
printStat("Column family length", cfLen);
printStat("Column qualifier length", cqLen);
printStat("Column visibility length", cvLen);
printStat("Value length", valLen);
printStat("Columns per row", colsPerRow);
System.out.println("");
}
}
}
use of org.apache.accumulo.core.util.Stat in project accumulo by apache.
the class CollectTabletStats method calcTabletStats.
private static void calcTabletStats(AccumuloClient client, String table, Authorizations auths, KeyExtent ke, String[] columns) throws Exception {
try (Scanner scanner = client.createScanner(table, auths)) {
scanner.setRange(new Range(ke.prevEndRow(), false, ke.endRow(), true));
for (String c : columns) {
scanner.fetchColumnFamily(new Text(c));
}
Stat rowLen = new Stat();
Stat cfLen = new Stat();
Stat cqLen = new Stat();
Stat cvLen = new Stat();
Stat valLen = new Stat();
Stat colsPerRow = new Stat();
Text lastRow = null;
int colsPerRowCount = 0;
for (Entry<Key, Value> entry : scanner) {
Key key = entry.getKey();
Text row = key.getRow();
if (lastRow == null) {
lastRow = row;
}
if (!lastRow.equals(row)) {
colsPerRow.addStat(colsPerRowCount);
lastRow = row;
colsPerRowCount = 0;
}
colsPerRowCount++;
rowLen.addStat(row.getLength());
cfLen.addStat(key.getColumnFamilyData().length());
cqLen.addStat(key.getColumnQualifierData().length());
cvLen.addStat(key.getColumnVisibilityData().length());
valLen.addStat(entry.getValue().get().length);
}
synchronized (System.out) {
System.out.println("");
System.out.println("\tTablet " + ke.getUUID() + " statistics : ");
printStat("Row length", rowLen);
printStat("Column family length", cfLen);
printStat("Column qualifier length", cqLen);
printStat("Column visibility length", cvLen);
printStat("Value length", valLen);
printStat("Columns per row", colsPerRow);
System.out.println("");
}
}
}
use of org.apache.accumulo.core.util.Stat in project accumulo by apache.
the class TestScanInfo method getIdleTimeStats.
@Override
public Stats getIdleTimeStats(long currentTime) {
Stat copy = idleTimeStats.copy();
copy.addStat(currentTime - lastRunTime.orElse(creationTime));
return copy;
}
use of org.apache.accumulo.core.util.Stat in project accumulo by apache.
the class IMMLGBenchmark method main.
public static void main(String[] args) throws Exception {
ZooKeeperInstance zki = new ZooKeeperInstance(ClientConfiguration.create().withInstance("test16").withZkHosts("localhost"));
Connector conn = zki.getConnector("root", new PasswordToken("secret"));
int numlg = Integer.parseInt(args[0]);
ArrayList<byte[]> cfset = new ArrayList<>();
for (int i = 0; i < 32; i++) {
cfset.add(String.format("%04x", i).getBytes());
}
Map<String, Stat> stats = new TreeMap<>();
for (int i = 0; i < 5; i++) {
runTest(conn, numlg, cfset, i > 1 ? stats : null);
System.out.println();
}
for (Entry<String, Stat> entry : stats.entrySet()) {
System.out.printf("%20s : %6.2f\n", entry.getKey(), entry.getValue().getAverage());
}
}
Aggregations