mirror of https://github.com/apache/cassandra
display elapsed time in 2 fraction digits in cli; patch by Radim Kolar, reviewed by yukim for CASSANDRA-3460
This commit is contained in:
parent
93bd3d896f
commit
c7ce11f003
|
|
@ -11,6 +11,7 @@
|
|||
* fix error when using ORDER BY with extended selections (CASSANDRA-4689)
|
||||
* (CQL3) Fix validation for IN queries for non-PK cols (CASSANDRA-4709)
|
||||
* fix re-created keyspace disappering after 1.1.5 upgrade (CASSANDRA-4698)
|
||||
* (CLI) display elapsed time in 2 fraction digits (CASSANDRA-3460)
|
||||
Merged from 1.0:
|
||||
* Switch from NBHM to CHM in MessagingService's callback map, which
|
||||
prevents OOM in long-running instances (CASSANDRA-4708)
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ public class CliClient
|
|||
throws InvalidRequestException, UnavailableException, TimedOutException, TException, IllegalAccessException, NotFoundException, InstantiationException, NoSuchFieldException
|
||||
{
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
long startTime = System.nanoTime();
|
||||
ColumnParent parent = new ColumnParent(columnFamily);
|
||||
if(superColumnName != null)
|
||||
parent.setSuper_column(superColumnName);
|
||||
|
|
@ -565,7 +565,7 @@ public class CliClient
|
|||
{
|
||||
if (!CliMain.isConnected() || !hasKeySpace())
|
||||
return;
|
||||
long startTime = System.currentTimeMillis();
|
||||
long startTime = System.nanoTime();
|
||||
Tree columnFamilySpec = statement.getChild(0);
|
||||
String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec, keyspacesMap.get(keySpace).cf_defs);
|
||||
ByteBuffer key = getKeyAsBytes(columnFamily, columnFamilySpec.getChild(1));
|
||||
|
|
@ -734,7 +734,7 @@ public class CliClient
|
|||
if (!CliMain.isConnected() || !hasKeySpace())
|
||||
return;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
IndexClause clause = new IndexClause();
|
||||
String columnFamily = CliCompiler.getColumnFamily(statement, keyspacesMap.get(keySpace).cf_defs);
|
||||
|
|
@ -828,7 +828,7 @@ public class CliClient
|
|||
if (!CliMain.isConnected() || !hasKeySpace())
|
||||
return;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
long startTime = System.nanoTime();
|
||||
// ^(NODE_COLUMN_ACCESS <cf> <key> <column>)
|
||||
Tree columnFamilySpec = statement.getChild(0);
|
||||
Tree keyTree = columnFamilySpec.getChild(1); // could be a function or regular text
|
||||
|
|
@ -1323,7 +1323,7 @@ public class CliClient
|
|||
if (!CliMain.isConnected() || !hasKeySpace())
|
||||
return;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
// extract column family
|
||||
String columnFamily = CliCompiler.getColumnFamily(statement, keyspacesMap.get(keySpace).cf_defs);
|
||||
|
|
@ -2968,9 +2968,25 @@ public class CliClient
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print elapsed time. Print 2 fraction digits if eta is under 10 ms.
|
||||
* @param startTime starting time in nanoseconds
|
||||
*/
|
||||
private void elapsedTime(long startTime)
|
||||
{
|
||||
sessionState.out.println("Elapsed time: " + (System.currentTimeMillis() - startTime) + " msec(s).");
|
||||
/** time elapsed in nanoseconds */
|
||||
long eta = System.nanoTime() - startTime;
|
||||
|
||||
sessionState.out.print("Elapsed time: ");
|
||||
if (eta < 10000000)
|
||||
{
|
||||
sessionState.out.print(Math.round(eta/10000.0)/100.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionState.out.print(Math.round(eta/1000000.0));
|
||||
}
|
||||
sessionState.out.println(" msec(s).");
|
||||
}
|
||||
|
||||
class CfAssumptions
|
||||
|
|
|
|||
Loading…
Reference in New Issue