Prints the results of the voting simulation and statistics
about performance.

@throws Exception if anything unexpected happens.
174748
public synchronized void printResults() throws Exception {
        ClientStats stats = fullStatsContext.fetch().getStats();

        // 1. Get/Put performance results
        String display = "\n" +
                         HORIZONTAL_RULE +
                         " KV Store Results\n" +
                         HORIZONTAL_RULE +
                         "\nA total of %,d operations were posted...\n" +
                         " - GETs: %,9d Operations (%,d Misses and %,d Failures)\n" +
                         "         %,9d MB in compressed store data\n" +
                         "         %,9d MB in uncompressed application data\n" +
                         "         Network Throughput: %6.3f Gbps*\n" +
                         " - PUTs: %,9d Operations (%,d Failures)\n" +
                         "         %,9d MB in compressed store data\n" +
                         "         %,9d MB in uncompressed application data\n" +
                         "         Network Throughput: %6.3f Gbps*\n" +
                         " - Total Network Throughput: %6.3f Gbps*\n\n" +
                         "* Figure includes key & value traffic but not database protocol overhead.\n\n";

        double oneGigabit = (1024 * 1024 * 1024) / 8;
        long oneMB = (1024 * 1024);
        double getThroughput = networkGetData.get() + (successfulGets.get() * config.keysize);
               getThroughput /= (oneGigabit * config.duration);
        long totalPuts = successfulPuts.get() + failedPuts.get();
        double putThroughput = networkGetData.get() + (totalPuts * config.keysize);
               putThroughput /= (oneGigabit * config.duration);

        System.out.printf(display,
                stats.getInvocationsCompleted(),
                successfulGets.get(), missedGets.get(), failedGets.get(),
                networkGetData.get() / oneMB,
                rawGetData.get() / oneMB,
                getThroughput,
                successfulPuts.get(), failedPuts.get(),
                networkPutData.get() / oneMB,
                rawPutData.get() / oneMB,
                putThroughput,
                getThroughput + putThroughput);

        // 2. Performance statistics
        System.out.print(HORIZONTAL_RULE);
        System.out.println(" Client Workload Statistics");
        System.out.println(HORIZONTAL_RULE);

        System.out.printf("Average throughput:            %,9d txns/sec\n", stats.getTxnThroughput());
        System.out.printf("Average latency:               %,9.2f ms\n", stats.getAverageLatency());
        System.out.printf("10th percentile latency:       %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.1));
        System.out.printf("25th percentile latency:       %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.25));
        System.out.printf("50th percentile latency:       %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.5));
        System.out.printf("75th percentile latency:       %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.75));
        System.out.printf("90th percentile latency:       %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.9));
        System.out.printf("95th percentile latency:       %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.95));
        System.out.printf("99th percentile latency:       %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.99));
        System.out.printf("99.5th percentile latency:     %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.995));
        System.out.printf("99.9th percentile latency:     %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.999));

        System.out.print("\n" + HORIZONTAL_RULE);
        System.out.println(" System Server Statistics");
        System.out.println(HORIZONTAL_RULE);

        System.out.printf("Reported Internal Avg Latency: %,9.2f ms\n", stats.getAverageInternalLatency());

        System.out.print("\n" + HORIZONTAL_RULE);
        System.out.println(" Latency Histogram");
        System.out.println(HORIZONTAL_RULE);
        System.out.println(stats.latencyHistoReport());

        // 3. Write stats to file if requested
        client.writeSummaryCSV(stats, config.statsfile);
    }
847526
public synchronized void printStatistics() {
        ClientStats stats = periodicStatsContext.fetchAndResetBaseline().getStats();
        long time = Math.round((stats.getEndTimestamp() - benchmarkStartTS) / 1000.0);

        System.out.printf("%02d:%02d:%02d ", time / 3600, (time / 60) % 60, time % 60);
        System.out.printf("Throughput %d/s, ", stats.getTxnThroughput());
        System.out.printf("Aborts/Failures %d/%d",
                stats.getInvocationAborts(), stats.getInvocationErrors());
        System.out.printf("\n");
    }
6782
public void storeResults() {
		System.out.println("Processed " + countItems + " items and "
				+ countProperties + " properties in total.");
		System.out.println("Storing data ...");

		try (PrintStream out = new PrintStream(new FileOutputStream(
				"tutorial-results.csv"))) {
			// Two simple entries for demonstration purposes.
			// Use your own code when you have more interesting data.
			out.println("count of items," + countItems);
			out.println("count of properties," + countProperties);
		} catch (IOException e) {
			System.out.println("Oops, I could not write the file: "
					+ e.toString());
		}

		System.out.println("... data stored.");

	}
393749
private void recordResult(ITestResult result) {
        // finalize our output file
        Reporter reporter = (Reporter) result.getAttribute(REPORTER);
        String htmlFilename = "";
        String pdfFilename = "";
        if (reporter != null) {
            // subtracting one from the status ordinal to map ITestResult to Success
            reporter.finalizeReporter(result.getStatus() - 1);
            htmlFilename = reporter.getFileName() + ".html";
            if (Property.generatePDF()) {
                pdfFilename = reporter.getFileName() + ".pdf";
            }
        }
        // update our reporter logger
        String testName = getTestName(result);
        Browser browser = (Browser) result.getAttribute(BROWSER);
        if (browser != null) {
            // subtracting one from the status ordinal to map ITestResult to Success
            org.testng.Reporter.log(
                    Success.values()[result.getStatus() - 1] + OUTPUT_BREAK + browser.getDetails() + OUTPUT_BREAK + LINK_START +
                            getFolderName(result) + "/" + htmlFilename + LINK_MIDDLE + testName + " HTML Report" +
                            LINK_END);
            if (!pdfFilename.isEmpty()) {
                org.testng.Reporter.log(OUTPUT_BREAK + LINK_START +
                        getFolderName(result) + "/" + pdfFilename + LINK_MIDDLE + testName + " PDF" +
                        LINK_END);
            }
            org.testng.Reporter.log(OUTPUT_BREAK + (result.getEndMillis() - result.getStartMillis()) / 1000 + TIME_UNIT);
        }
        // update sauce labs
        if (Sauce.isSauce() && result.getAttributeNames().contains(SESSION_ID)) {
            String sessionId = result.getAttribute(SESSION_ID).toString();
            JsonObject json = new JsonObject();
            json.addProperty("passed", result.getStatus() == 1);
            JsonArray tags = new JsonArray();
            for (String tag : result.getMethod().getGroups()) {
                tags.add(tag);
            }
            json.add("tags", tags);
            try {
                HTTP http = new HTTP(null, "https://saucelabs.com/rest/v1/" + Sauce.getSauceUser() + "/jobs/", Sauce.getSauceUser(),
                        Sauce.getSauceKey());
                http.put(sessionId, new Request().setJsonPayload(json), null);
            } catch (InvalidHubException e) {
                log.error("Unable to connect to sauce, due to credential problems");
            } catch (IOException e) {
                log.error(e);
            }
        }
    }
1292143
public void runBenchmark() throws Exception {
        System.out.print(HORIZONTAL_RULE);
        System.out.println(" Setup & Initialization");
        System.out.println(HORIZONTAL_RULE);

        // connect to one or more servers, loop until success
        connect(client, config.servers);

        for (long i = 0; i < config.tuples; i++) {
            ClientResponse response = client.callProcedure("Init", i, i);
            if (response.getStatus() != ClientResponse.SUCCESS) {
                System.exit(-1);
            }
        }

        System.out.print("\n\n" + HORIZONTAL_RULE);
        System.out.println(" Starting Benchmark");
        System.out.println(HORIZONTAL_RULE);

        System.out.println("\nWarming up...");
        final long warmupEndTime = System.currentTimeMillis() + (1000l * config.warmup);
        while (warmupEndTime > System.currentTimeMillis()) {
            increment();
        }

        // reset counters before the real benchmark starts post-warmup
        incrementCount.set(0);
        lastPeriod.set(0);
        failureCount.set(0);
        lastStatsReportTS = System.currentTimeMillis();

        // print periodic statistics to the console
        benchmarkStartTS = System.currentTimeMillis();
        TimerTask statsPrinting = new TimerTask() {
            @Override
            public void run() { printStatistics(); }
        };
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(statsPrinting,
                                  config.displayinterval * 1000,
                                  config.displayinterval * 1000);

        // Run the benchmark loop for the requested duration
        // The throughput may be throttled depending on client configuration
        System.out.println("\nRunning benchmark...");
        final long benchmarkEndTime = System.currentTimeMillis() + (1000l * config.duration);
        while (benchmarkEndTime > System.currentTimeMillis()) {
            increment();
        }

        // cancel periodic stats printing
        timer.cancel();
        // block until all outstanding txns return
        client.drain();
        // close down the client connections
        client.close();
    }
403159
public void writeFinalResults() {
		printStatus();

		try (PrintStream out = new PrintStream(
				ExampleHelpers.openExampleFileOuputStream("gender-ratios.csv"))) {

			out.print("Site key,pages total,pages on humans,pages on humans with gender");
			for (EntityIdValue gender : this.genderNamesList) {
				out.print("," + this.genderNames.get(gender) + " ("
						+ gender.getId() + ")");
			}
			out.println();

			List<SiteRecord> siteRecords = new ArrayList<>(
					this.siteRecords.values());
			Collections.sort(siteRecords, new SiteRecordComparator());
			for (SiteRecord siteRecord : siteRecords) {
				out.print(siteRecord.siteKey + "," + siteRecord.pageCount + ","
						+ siteRecord.humanPageCount + ","
						+ siteRecord.humanGenderPageCount);

				for (EntityIdValue gender : this.genderNamesList) {
					if (siteRecord.genderCounts.containsKey(gender)) {
						out.print("," + siteRecord.genderCounts.get(gender));
					} else {
						out.print(",0");
					}
				}
				out.println();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
650995
protected void printResults(PrintStream out) {
        log.debug("printResults()");
        StringBuilder line = new StringBuilder();
        out.println(line);
        out.println();
    }
598374
protected PrintResult withOpenOutputStream(final PrintAction function) throws Exception {
        final File reportFile = getReportFile();
        final Processor.ExecutionContext executionContext;
        try (FileOutputStream out = new FileOutputStream(reportFile);
             BufferedOutputStream bout = new BufferedOutputStream(out)) {
            executionContext = function.run(bout);
        }
        return new PrintResult(reportFile.length(), executionContext);
    }
1294761
def _print_results(results, stat=False, verbose=False):
    
    results.generate_pretty_output(stat=stat,
                                   verbose=verbose,
                                   output_function=click.secho)
265031
public static void printCoverageData(GridCoverage2D coverage) {
        RenderedImage renderedImage = coverage.getRenderedImage();
        RandomIter renderedImageIterator = RandomIterFactory.create(renderedImage, null);
        int[] colsRows = CoverageUtilities.getRegionColsRows(coverage);
        for (int r = 0; r < colsRows[1]; r++) {
            for (int c = 0; c < colsRows[0]; c++) {
                printer.print(renderedImageIterator.getSampleDouble(c, r, 0));
                printer.print(separator);
            }
            printer.println();
        }
    }
652003
public void perf() throws Exception {

        int maxTests = 50000;
        String storedSiteRoot = m_cms.getRequestContext().getSiteRoot();
        try {
            m_cms.getRequestContext().setSiteRoot("/");
            Random random = new Random();
            // create a resource filter to get the resources with
            List<CmsResource> testResources = m_cms.readResources("/", CmsResourceFilter.ALL);
            int resourceCount = testResources.size();
            m_shell.getOut().println("#Resources:\t" + resourceCount);
            long start, time;
            long totalTime = 0;
            long minTime = Long.MAX_VALUE;
            long maxTime = Long.MIN_VALUE;
            m_shell.getOut().print("readFileHeader:\t");
            for (int i = maxTests; i > 0; --i) {
                int index = random.nextInt(resourceCount);
                CmsResource resource = testResources.get(index);
                start = System.currentTimeMillis();
                m_cms.readResource(m_cms.getSitePath(resource), CmsResourceFilter.ALL);
                time = System.currentTimeMillis() - start;
                totalTime += time;
                if (time < minTime) {
                    minTime = time;
                }
                if (time > maxTime) {
                    maxTime = time;
                }
                if ((i % 100) == 0) {
                    m_shell.getOut().print('.');
                }
            }
            m_shell.getOut().println(
                "\nreadFileHeader:\t" + minTime + "\t" + maxTime + "\t" + (((float)totalTime) / maxTests) + " ms");

        } finally {
            m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
        }
    }
1157993
public void initialize() throws Exception {

        List<Long> acctList = new ArrayList<Long>(config.custcount*2);
        List<String> stList = new ArrayList<String>(config.custcount*2);

        // generate customers
        System.out.println("generating " + config.custcount + " customers...");
        for (int c=0; c<config.custcount; c++) {

            if (c % 10000 == 0) {
                System.out.println("  "+c);
            }

            PersonGenerator.Person p = gen.newPerson();
            //int ac = rand.nextInt(areaCodes.length);

            client.callProcedure(new BenchmarkCallback("CUSTOMER.insert"),
                                 "CUSTOMER.insert",
                                 c,
                                 p.firstname,
                                 p.lastname,
                                 "Anytown",
                                 p.state,
                                 p.phonenumber,
                                 p.dob,
                                 p.sex
                                 );

            int accts = rand.nextInt(5);
            for (int a=0; a<accts; a++) {

                int acct_no = (c*100)+a;
                client.callProcedure(new BenchmarkCallback("ACCOUNT.insert"),
                                     "ACCOUNT.insert",
                                     acct_no,
                                     c,
                                     rand.nextInt(10000),
                                     rand.nextInt(10000),
                                     new Date(),
                                     "Y"
                                     );
                acctList.add(Long.valueOf(acct_no));
                stList.add(p.state);
            }
        }

        accounts = acctList.toArray(new Long[acctList.size()]);
        acct_states = stList.toArray(new String[stList.size()]);

        // generate vendor offers
        System.out.println("generating " + config.vendorcount + " vendors...");
        for (int v = 0; v < config.vendorcount; v++) {
            if (v % 10000 == 0) {
                System.out.println("  " + v);
            }

            client.callProcedure(new BenchmarkCallback("VENDOR_OFFERS.insert"),
                                 "VENDOR_OFFERS.insert",
                                 v,
                                 rand.nextInt(5) + 1,
                                 0,
                                 rand.nextInt(5) + 1,
                                 (double) rand.nextInt(100),
                                 0,
                                 offers[rand.nextInt(offers.length)]
                                 );
        }
    }
1077997
@Execute
    public void process() throws Exception {
        if (!concatOr(outPit == null, doReset)) {
            return;
        }
        checkNull(inElev);
        HashMap<String, Double> regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inElev);
        nCols = regionMap.get(CoverageUtilities.COLS).intValue();
        nRows = regionMap.get(CoverageUtilities.ROWS).intValue();
        xRes = regionMap.get(CoverageUtilities.XRES);
        yRes = regionMap.get(CoverageUtilities.YRES);

        elevationIter = CoverageUtilities.getRandomIterator(inElev);

        // output raster
        WritableRaster pitRaster = CoverageUtilities.createWritableRaster(nCols, nRows, null, null, null);
        pitIter = CoverageUtilities.getWritableRandomIterator(pitRaster);

        for( int i = 0; i < nRows; i++ ) {
            if (pm.isCanceled()) {
                return;
            }
            for( int j = 0; j < nCols; j++ ) {
                double value = elevationIter.getSampleDouble(j, i, 0);
                if (!isNovalue(value)) {
                    pitIter.setSample(j, i, 0, value);
                } else {
                    pitIter.setSample(j, i, 0, PITNOVALUE);
                }
            }
        }

        flood();
        if (pm.isCanceled()) {
            return;
        }

        for( int i = 0; i < nRows; i++ ) {
            if (pm.isCanceled()) {
                return;
            }
            for( int j = 0; j < nCols; j++ ) {
                if (dir[j][i] == 0) {
                    return;
                }
                double value = pitIter.getSampleDouble(j, i, 0);
                if (value == PITNOVALUE || isNovalue(value)) {
                    pitIter.setSample(j, i, 0, doubleNovalue);
                }
            }
        }
        pitIter.done();

        outPit = CoverageUtilities.buildCoverage("pitfiller", pitRaster, regionMap, inElev.getCoordinateReferenceSystem());
    }
134110
@SuppressWarnings("unchecked")
    private static void printUsage(final Exception e) {
        printVersion();
        if (e != null) {
            System.out.println(e.getMessage() + "\n");
        }

        HelpFormatter hf = new HelpFormatter();

        StringBuilder sbDivider = new StringBuilder("=");
        while (sbDivider.length() < hf.getPageWidth()) {
            sbDivider.append("=");
        }

        // DISPLAY SETTING
        hf.getDisplaySettings().clear();
        hf.getDisplaySettings().add(DisplaySetting.DISPLAY_GROUP_EXPANDED);
        hf.getDisplaySettings().add(DisplaySetting.DISPLAY_PARENT_CHILDREN);

        // USAGE SETTING

        hf.getFullUsageSettings().clear();
        hf.getFullUsageSettings().add(DisplaySetting.DISPLAY_PARENT_ARGUMENT);
        hf.getFullUsageSettings().add(DisplaySetting.DISPLAY_ARGUMENT_BRACKETED);
        hf.getFullUsageSettings().add(DisplaySetting.DISPLAY_PARENT_CHILDREN);
        hf.getFullUsageSettings().add(DisplaySetting.DISPLAY_GROUP_EXPANDED);

        hf.setDivider(sbDivider.toString());

        hf.setGroup(configureCommandLine());
        hf.print();
        System.exit(0);
    }
659601
private static void printData(StatisticsContext context)
   {
      if (context.writer == null)
      {
         return;
      }
      boolean first = true;
      if (context.global != null)
      {
         context.global.printData(context.writer);
         first = false;
      }
      for (Statistics s : context.allStatistics.values())
      {
         if (first)
         {
            first = false;
         }
         else
         {
            context.writer.print(',');
         }
         s.printData(context.writer);
      }
      context.writer.println();
      context.writer.flush();
   }
767550
function printResults()
    {
        $results = $this->resultList();
        foreach ( $results as $result )
        {
            $this->display( $result );
        }
    }
266779
def PrintStats(self):
    """"""
    self.BuildStats()
    self.PrintSummaryTable()
    self.PrintSourceTypeTable()
    self.PrintOSTable()
    self.PrintLabelTable()