当前位置: 首页>>代码示例>>Java>>正文


Java ConsoleReporter.report方法代码示例

本文整理汇总了Java中com.codahale.metrics.ConsoleReporter.report方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleReporter.report方法的具体用法?Java ConsoleReporter.report怎么用?Java ConsoleReporter.report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codahale.metrics.ConsoleReporter的用法示例。


在下文中一共展示了ConsoleReporter.report方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String... args) {

        MetricRegistry metricRegistry = new MetricRegistry();

        final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.MILLISECONDS).build();

        GitHub github = Feign.builder().invocationHandlerFactory(
                new FeignOutboundMetricsDecorator(new InvocationHandlerFactory.Default(), metricRegistry))
                .decoder(new GsonDecoder()).target(GitHub.class, "https://api.github.com");

        // Fetch and print a list of the contributors to this library.
        List<Contributor> contributors = github.contributors("mwiede", "metrics-feign");
        for (Contributor contributor : contributors) {
            System.out.println(contributor.login + " (" + contributor.contributions + ")");
        }

        reporter.report();
    }
 
开发者ID:mwiede,项目名称:metrics-feign,代码行数:20,代码来源:Example.java

示例2: run

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
private void run(PrintStream printStream) {
    long sleepPeriodMillis = config.getMetricsOutputPeriodSeconds() * 1000;
    ConsoleReporter consoleReporter = ConsoleReporter
            .forRegistry(metricRegistry)
            .outputTo(printStream)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
    while (true) {
        try {
            Thread.sleep(sleepPeriodMillis);
            consoleReporter.report();
        } catch (InterruptedException ignored) {
            interrupt();
            LOGGER.trace("interrupted");
            break;
        }
    }
}
 
开发者ID:vy,项目名称:hrrs,代码行数:20,代码来源:MetricFileReporter.java

示例3: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    MetricRegistry metrics = new MetricRegistry();
    ConsoleReporter reporter = PerformanceHelper.consoleReporter(metrics);
    Timer timer = metrics.timer("allocations");

    Random random = new Random(System.nanoTime());
    int iterations = 1000000;
    MemoryPointer[] pointerArray = new MemoryPointer[iterations];

    for (int i = 0; i < pointerArray.length; i++) {
        Timer.Context watch = timer.time();
        pointerArray[i] = MemoryAllocator.allocate(random.nextInt(16384));
        watch.stop();
    }

    reporter.report();
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:18,代码来源:MemoryPerformance.java

示例4: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) {
    MetricRegistry metrics = new MetricRegistry();
    ConsoleReporter reporter = PerformanceHelper.consoleReporter(metrics);
    Timer timer = metrics.timer("reads");
    TupleGenerator generator = new TupleGenerator();
    List<Tuple> tuples = generator.testRecords(1, 64000, 20, 16, 100);

    TupleBlock.Builder blockBuilder = new TupleBlock.Builder();
    for (Tuple tuple : tuples) {
        blockBuilder.addRecord(tuple);
    }

    TupleBlock block = blockBuilder.build();

    Random random = new Random(System.nanoTime());
    int iterations = 10000000;

    for (int i = 0; i < iterations; i++) {
        Timer.Context watch = timer.time();
        block.get(tuples.get(random.nextInt(tuples.size())).key());
        watch.stop();
    }

    reporter.report();
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:26,代码来源:RecordBlockPerformance.java

示例5: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    MetricRegistry metrics = new MetricRegistry();
    ConsoleReporter reporter = PerformanceHelper.consoleReporter(metrics);
    Timer timer = metrics.timer("writes");

    TestFileHelper.createTestDirectory();
    KeyValueGenerator keyValueGenerator = new KeyValueGenerator();
    Value value = new Value(keyValueGenerator.testValue(100));

    DBState state = ConfigGenerator.perfState();
    TableWriter tableWriter = new TableWriter(state.config(), state.paths(), state.tables(), state.snapshots(),
            state.caches(), new Metrics(state.config()));

    for (int i = 0; i < RECORD_COUNT; i++) {
        value.data().rewind();
        Timer.Context watch = timer.time();
        tableWriter.write(ByteBuffers.fromString(i + ""), value.data(), false);
        watch.stop();
    }

    reporter.report();
    tableWriter.close();

    TestFileHelper.cleanUpTestFiles();
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:26,代码来源:RecordWriterPerformance.java

示例6: dumpMetrics

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
@TearDown
        public void dumpMetrics() throws Exception {

            // enable when using yourkit for single runs
//            if (controller != null) {
//                controller.captureSnapshot(Controller.SNAPSHOT_WITH_HEAP);
//            }
            final MetricRegistry metrics = injector.getInstance(MetricRegistry.class);
            // make the registry available to the profiler
            metricRegistry = metrics;
            final ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics)
                    .outputTo(new PrintStream("/tmp/bench-" + directoryName + ".txt"))
                    .build();
            reporter.report();
        }
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:16,代码来源:PipelinePerformanceBenchmarks.java

示例7: acceptVisitor

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public void acceptVisitor(ServerVisitor serverVisitor){
    //MetricRegistry to string
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos,false, "UTF-8");
        ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metricRegistry).outputTo(ps).build();
        consoleReporter.report();
        consoleReporter.stop();
        serverVisitor.jettyReport=new String(baos.toByteArray(), StandardCharsets.UTF_8);
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:14,代码来源:InstrumentedJettyServer.java

示例8: reportTo

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public void reportTo(PrintStream out) {
    ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(context.getMetrics())
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .convertRatesTo(TimeUnit.SECONDS)
            .filter(MetricFilter.ALL)
            .outputTo(out)
            .build();
    consoleReporter.report();
}
 
开发者ID:jshook,项目名称:testclient,代码行数:10,代码来源:Result.java

示例9: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    JDBCBenchmark bench = new JDBCBenchmark();

    Random r = new Random();

    MetricRegistry mr = new MetricRegistry();
    Timer timer = mr.timer("shadow/pgsql/benchmark");

    System.out.println("Press any key to start.");
    // System.in.read();

    System.out.println("Looping");
    for (int i = 0; i < 50000; i++) {
        Timer.Context t = timer.time();
        bench.selectPojos();

        long duration = t.stop();
        //System.out.format("got %d pojos\n", pojos.size());
        if (i % 500 == 0) {
            System.out.format("run: %d duration: %d\n", i, duration);
        }
    }
    System.out.println("Completed press any key to quit");
    System.in.read();
    bench.close();

    ConsoleReporter report = ConsoleReporter.forRegistry(mr)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();

    report.report();
}
 
开发者ID:thheller,项目名称:shadow-pgsql,代码行数:34,代码来源:JDBCBenchmark.java

示例10: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        final MetricRegistry metricRegistry = new MetricRegistry();
        final Meter meter = metricRegistry.meter("throughput");
        final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry)
                .convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.MILLISECONDS)
                .build();
        reporter.start(1, TimeUnit.MINUTES);

        final Properties properties = new Properties();
        properties.setProperty("zookeeper.connect", "localhost:2181");
        properties.setProperty("group.id", "myclient");
        properties.setProperty("zookeeper.session.timeout.ms", "400");
        properties.setProperty("zookeeper.sync.time.ms", "200");
        properties.setProperty("auto.commit.interval.ms", "1000");
        properties.setProperty("auto.offset.reset", "smallest");
        properties.setProperty("consumer.timeout.ms", "10000");

        final ConsumerConfig consumerConfig = new ConsumerConfig(properties);

        final String topic = "csc8101";
        final int numThreads = 4;

        final ConsumerConnector consumerConnector = Consumer.createJavaConsumerConnector(consumerConfig);
        final Map<String, Integer> topicCountMap = new HashMap<>();
        topicCountMap.put(topic, numThreads);
        final Decoder<String> decoder = new StringDecoder(new VerifiableProperties());
        final Map<String, List<KafkaStream<String, String>>> streamsMap =
                consumerConnector.createMessageStreams(topicCountMap, decoder, decoder);

        final ExecutorService executorService = Executors.newFixedThreadPool(numThreads);

        for(final KafkaStream<String, String> stream : streamsMap.get(topic)) {
            final MessageHandler messageHandler = new MessageHandler();
            final RunnableConsumer runnableConsumer = new RunnableConsumer(stream, messageHandler, meter);
            executorService.submit(runnableConsumer);
        }

        executorService.shutdown();
        executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.HOURS);

        consumerConnector.shutdown();

        MessageHandler.close();

        reporter.report();
        reporter.stop();

        // we use the newer version of metrics, which shuts itself down cleanly. But...
        // kafka still uses the old one and doesn't shut it down properly,
        // leaving some metrics-meter-tick-thread lying around. So to avoid
        // java.lang.IllegalThreadStateException from mvn:exec wrapper we terminate it explicitly here
        com.yammer.metrics.Metrics.defaultRegistry().shutdown();

        // bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zkconnect localhost:2181 --group myclient
    }
 
开发者ID:jhalliday,项目名称:csc8101,代码行数:58,代码来源:KafkaConsumer.java

示例11: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String []args) throws ExecutionException, InterruptedException {
    InRamSim sim = new InRamSim(3);
    ConsoleReporter reporter = ConsoleReporter.forRegistry(sim.metrics)
            .convertDurationsTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();

    reporter.start(5, TimeUnit.SECONDS);
    sim.run();
    System.out.println("All done baby");
    sim.dispose();
    reporter.report();
    reporter.stop();
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:15,代码来源:InRamSim.java

示例12: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) {
    MetricRegistry metrics = new MetricRegistry();
    ConsoleReporter reporter = PerformanceHelper.consoleReporter(metrics);
    Timer timer = metrics.timer("blockCreationTime");

    KeyValueGenerator generator = new KeyValueGenerator();
    List<Key> keys = new ArrayList<Key>();

    for (int i = 0; i < 64000; i++) {
        keys.add(new Key(generator.testKey(32, 0), i));
    }

    Collections.sort(keys);

    IndexBlock.Builder blockBuilder = new IndexBlock.Builder();

    for (Key key : keys) {
        blockBuilder.addRecord(new IndexRecord(key, 0, 128));
    }

    IndexBlock block = blockBuilder.build();
    MemoryPointer blockPointer = block.memory();

    int iterations = 10000000;

    for (int i = 0; i < iterations; i++) {
        Timer.Context watch = timer.time();
        block = new IndexBlock(new SortedByteMap(blockPointer));
        watch.stop();
    }

    reporter.report();
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:34,代码来源:BlockCreationPerformance.java

示例13: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Random random = new Random(System.nanoTime());

    Config config = new Config.Builder().directory(TestFileHelper.TEMP_PATH).compactionStrategy
            (CompactionStrategies.SIZE_TIERED_COMPACTION_STRATEGY).tableCacheSize(512000000).indexCacheSize
            (64000000).maxWriteRate(Integer.MAX_VALUE).build();

    MetricRegistry metrics = new MetricRegistry();
    ConsoleReporter reporter = PerformanceHelper.consoleReporter(metrics);
    Timer readTimer = metrics.register("reads", new Timer(new ExponentiallyDecayingReservoir()));

    DB db = HeftyDB.open(config);

    db.compact().get();

    //Read
    for (int i = 0; i < RECORD_COUNT * 10; i++) {
        String key = random.nextInt(RECORD_COUNT) + "";
        Timer.Context watch = readTimer.time();
        db.get(ByteBuffers.fromString(key));
        watch.stop();
    }

    reporter.report();
    db.logMetrics();
    db.close();

    System.exit(0);
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:30,代码来源:ReadPerformance.java

示例14: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    MetricRegistry metrics = new MetricRegistry();
    ConsoleReporter reporter = PerformanceHelper.consoleReporter(metrics);
    Timer scanTimer = metrics.timer("scans");

    TestFileHelper.createTestDirectory();
    KeyValueGenerator keyValueGenerator = new KeyValueGenerator();
    Value value = new Value(keyValueGenerator.testValue(100));

    Config config = ConfigGenerator.defaultConfig();

    //Write
    final DB db = HeftyDB.open(config);

    for (int i = 0; i < RECORD_COUNT; i++) {
        value.data().rewind();
        db.put(ByteBuffers.fromString(i + ""), value.data());
    }

    //Scan
    Iterator<Record> iterator = db.ascendingIterator(Snapshot.MAX);

    while (iterator.hasNext()) {
        Timer.Context watch = scanTimer.time();
        iterator.next();
        watch.stop();
    }

    db.close();

    reporter.report();

    TestFileHelper.cleanUpTestFiles();
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:35,代码来源:ScanPerformance.java

示例15: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    TestFileHelper.createTestDirectory();
    TestFileHelper.cleanUpTestFiles();
    KeyValueGenerator keyValueGenerator = new KeyValueGenerator();
    ByteBuffer testValueBuffer = keyValueGenerator.testValue(100);

    Config config = new Config.Builder().directory(TestFileHelper.TEMP_PATH).memoryTableSize(16384000)
            .tableCacheSize(512000000).indexCacheSize(64000000).tableBlockSize(16384).compactionStrategy
                    (CompactionStrategies.SIZE_TIERED_COMPACTION_STRATEGY).indexBlockSize(32768).maxWriteRate
                    (Integer.MAX_VALUE).build();

    //Write
    DB db = HeftyDB.open(config);

    MetricRegistry metrics = new MetricRegistry();
    ConsoleReporter reporter = PerformanceHelper.consoleReporter(metrics);
    Timer writeTimer = metrics.timer("writes");

    for (int i = 0; i < RECORD_COUNT; i++) {
        Timer.Context watch = writeTimer.time();
        db.put(ByteBuffers.fromString(i + ""), testValueBuffer.slice());
        watch.stop();
    }

    reporter.report();
    db.close();
}
 
开发者ID:jordw,项目名称:heftydb,代码行数:28,代码来源:WritePerformance.java


注:本文中的com.codahale.metrics.ConsoleReporter.report方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。