maedhroz commented on code in PR #1754:
URL: https://github.com/apache/cassandra/pull/1754#discussion_r931608676


##########
src/java/org/apache/cassandra/tools/nodetool/GetStreamThroughput.java:
##########
@@ -17,27 +17,70 @@
  */
 package org.apache.cassandra.tools.nodetool;
 
+import com.google.common.math.DoubleMath;
+
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
 
-@Command(name = "getstreamthroughput", description = "Print the throughput cap 
for streaming and entire SSTable streaming in the system")
+@Command(name = "getstreamthroughput", description = "Print the throughput cap 
for streaming and entire SSTable streaming in the system in rounded megabits. " 
+
+                                                     "For precise number, 
please, use option -d")
 public class GetStreamThroughput extends NodeToolCmd
 {
     @SuppressWarnings("UnusedDeclaration")
-    @Option(name = { "-e", "--entire-sstable-throughput" }, description = 
"Print entire SSTable streaming throughput")
+    @Option(name = { "-e", "--entire-sstable-throughput" }, description = 
"Print entire SSTable streaming throughput in MiB/s")
     private boolean entireSSTableThroughput;
 
+    @SuppressWarnings("UnusedDeclaration")
+    @Option(name = { "-m", "--mib" }, description = "Print the throughput cap 
for streaming in MiB/s")
+    private boolean streamThroughputMiB;
+
+    @SuppressWarnings("UnusedDeclaration")
+    @Option(name = { "-d", "--precise-mbit" }, description = "Print the 
throughput cap for streaming in precise Mbits (double)")
+    private boolean streamThroughputDoubleMbit;
+
     @Override
     public void execute(NodeProbe probe)
     {
-        int throughput = entireSSTableThroughput ? 
probe.getEntireSSTableStreamThroughput() : probe.getStreamThroughput();
+        int throughput;
+        double throughputInDouble;
+
+        if (entireSSTableThroughput)
+        {
+            if(streamThroughputDoubleMbit || streamThroughputMiB)
+                throw new IllegalArgumentException("You cannot use more than 
one flag with this command");
+
+            throughputInDouble = probe.getEntireSSTableStreamThroughput();
+            probe.output().out.printf("Current entire SSTable stream 
throughput: %s%n",
+                                      throughputInDouble > 0 ? 
throughputInDouble + " MiB/s" : "unlimited");
+        }
+        else if (streamThroughputMiB)
+        {
+            if(streamThroughputDoubleMbit)

Review Comment:
   ```suggestion
               if (streamThroughputDoubleMbit)
   ```



##########
src/java/org/apache/cassandra/tools/nodetool/GetStreamThroughput.java:
##########
@@ -17,27 +17,70 @@
  */
 package org.apache.cassandra.tools.nodetool;
 
+import com.google.common.math.DoubleMath;
+
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
 
-@Command(name = "getstreamthroughput", description = "Print the throughput cap 
for streaming and entire SSTable streaming in the system")
+@Command(name = "getstreamthroughput", description = "Print the throughput cap 
for streaming and entire SSTable streaming in the system in rounded megabits. " 
+
+                                                     "For precise number, 
please, use option -d")
 public class GetStreamThroughput extends NodeToolCmd
 {
     @SuppressWarnings("UnusedDeclaration")
-    @Option(name = { "-e", "--entire-sstable-throughput" }, description = 
"Print entire SSTable streaming throughput")
+    @Option(name = { "-e", "--entire-sstable-throughput" }, description = 
"Print entire SSTable streaming throughput in MiB/s")
     private boolean entireSSTableThroughput;
 
+    @SuppressWarnings("UnusedDeclaration")
+    @Option(name = { "-m", "--mib" }, description = "Print the throughput cap 
for streaming in MiB/s")
+    private boolean streamThroughputMiB;
+
+    @SuppressWarnings("UnusedDeclaration")
+    @Option(name = { "-d", "--precise-mbit" }, description = "Print the 
throughput cap for streaming in precise Mbits (double)")
+    private boolean streamThroughputDoubleMbit;
+
     @Override
     public void execute(NodeProbe probe)
     {
-        int throughput = entireSSTableThroughput ? 
probe.getEntireSSTableStreamThroughput() : probe.getStreamThroughput();
+        int throughput;
+        double throughputInDouble;
+
+        if (entireSSTableThroughput)
+        {
+            if(streamThroughputDoubleMbit || streamThroughputMiB)

Review Comment:
   ```suggestion
               if (streamThroughputDoubleMbit || streamThroughputMiB)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to