Package io.grpc.benchmarks
Class Utils
- java.lang.Object
-
- io.grpc.benchmarks.Utils
-
public final class Utils extends java.lang.ObjectUtility methods to support benchmarking classes.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_FLOW_CONTROL_WINDOWstatic longHISTOGRAM_MAX_VALUEstatic intHISTOGRAM_PRECISION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Messages.SimpleRequestmakeRequest(Messages.PayloadType payloadType, int reqLength, int respLength)Construct aMessages.SimpleRequestwith the specified dimensions.static Messages.SimpleResponsemakeResponse(Messages.SimpleRequest request)Construct aMessages.SimpleResponsefor the given request.static io.grpc.ManagedChannelnewClientChannel(Transport transport, java.lang.String target, boolean tls, boolean testca, java.lang.String authorityOverride, int flowControlWindow, boolean directExecutor)Create aManagedChannelfor the given parameters.static booleanparseBoolean(java.lang.String value)static java.net.SocketAddressparseServerSocketAddress(java.lang.String value)Parse aSocketAddressfrom the given string.static intpickUnusedPort()Picks a port that is not used right at this moment.static voidsaveHistogram(org.HdrHistogram.Histogram histogram, java.lang.String filename)Save aHistogramto a file.
-
-
-
Field Detail
-
HISTOGRAM_MAX_VALUE
public static final long HISTOGRAM_MAX_VALUE
- See Also:
- Constant Field Values
-
HISTOGRAM_PRECISION
public static final int HISTOGRAM_PRECISION
- See Also:
- Constant Field Values
-
DEFAULT_FLOW_CONTROL_WINDOW
public static final int DEFAULT_FLOW_CONTROL_WINDOW
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseBoolean
public static boolean parseBoolean(java.lang.String value)
-
parseServerSocketAddress
public static java.net.SocketAddress parseServerSocketAddress(java.lang.String value)
Parse aSocketAddressfrom the given string.
-
newClientChannel
public static io.grpc.ManagedChannel newClientChannel(Transport transport, java.lang.String target, boolean tls, boolean testca, @Nullable java.lang.String authorityOverride, int flowControlWindow, boolean directExecutor)
Create aManagedChannelfor the given parameters.
-
saveHistogram
public static void saveHistogram(org.HdrHistogram.Histogram histogram, java.lang.String filename) throws java.io.IOExceptionSave aHistogramto a file.- Throws:
java.io.IOException
-
makeResponse
public static Messages.SimpleResponse makeResponse(Messages.SimpleRequest request)
Construct aMessages.SimpleResponsefor the given request.
-
makeRequest
public static Messages.SimpleRequest makeRequest(Messages.PayloadType payloadType, int reqLength, int respLength)
Construct aMessages.SimpleRequestwith the specified dimensions.
-
pickUnusedPort
public static int pickUnusedPort()
Picks a port that is not used right at this moment. Warning: Not thread safe. May see "BindException: Address already in use: bind" if using the returned port to create a new server socket when other threads/processes are concurrently creating new sockets without a specific port.
-
-