MCPcopy Create free account
hub / github.com/grpc/grpc-java / saveHistogram

Method saveHistogram

benchmarks/src/main/java/io/grpc/benchmarks/Utils.java:233–248  ·  view source on GitHub ↗

Save a Histogram to a file.

(Histogram histogram, String filename)

Source from the content-addressed store, hash-verified

231 * Save a {@link Histogram} to a file.
232 */
233 public static void saveHistogram(Histogram histogram, String filename) throws IOException {
234 File file;
235 PrintStream log = null;
236 try {
237 file = new File(filename);
238 if (file.exists() && !file.delete()) {
239 System.err.println("Failed deleting previous histogram file: " + file.getAbsolutePath());
240 }
241 log = new PrintStream(new FileOutputStream(file), false);
242 histogram.outputPercentileDistribution(log, 1.0);
243 } finally {
244 if (log != null) {
245 log.close();
246 }
247 }
248 }
249
250 /**
251 * Construct a {@link SimpleResponse} for the given request.

Callers 2

runMethod · 0.80
runMethod · 0.80

Calls 2

closeMethod · 0.65
existsMethod · 0.45

Tested by

no test coverage detected