Package com.sun.sgs.impl.service.nodemap.affinity.single

Examples of com.sun.sgs.impl.service.nodemap.affinity.single.SingleLabelPropagation


    public void warmupZach() throws Exception {
        // Warm up the compilers
        Properties props = new Properties();
        props.put("com.sun.sgs.impl.service.nodemap.affinity.numThreads",
                    String.valueOf(numThreads));
        SingleLabelPropagation lpa =
           new SingleLabelPropagation(new ZachBuilder(), collector, props);

        for (int i = 0; i < WARMUP_RUNS; i++) {
            lpa.findAffinityGroups();
        }
        lpa.shutdown();
    }
View Full Code Here


        AffinityGraphBuilder builder = new ZachBuilder();
        Properties props = new Properties();
        props.put("com.sun.sgs.impl.service.nodemap.affinity.numThreads",
                    String.valueOf(numThreads));
        // third argument true:  gather statistics
        SingleLabelPropagation lpa =
            new SingleLabelPropagation(builder, collector, props);

        AffinityGroupFinderMXBean bean = (AffinityGroupFinderMXBean)
            collector.getRegisteredMBean(AffinityGroupFinderMXBean.MXBEAN_NAME);
        assertNotNull(bean);
        bean.clear();
        // Be sure the consumer is turned on
        collector.getConsumer(AffinityGroupFinderStats.CONS_NAME).
                    setProfileLevel(ProfileLevel.MAX);
       
        double avgMod  = 0.0;
        double maxMod = 0.0;
        double minMod = 1.0;
        for (int i = 0; i < RUNS; i++) {
            Set<AffinityGroup> groups =
                    Objects.uncheckedCast(lpa.findAffinityGroups());
            double mod =
                AffinityGroupGoodness.calcModularity(
                                new ZachBuilder().getAffinityGraph(), groups);

            avgMod = avgMod + mod;
            maxMod = Math.max(maxMod, mod);
            minMod = Math.min(minMod, mod);
        }
        System.out.printf("SING (%d runs, %d threads): " +
                  "avg time : %4.2f ms, " +
                  " time range [%d - %d ms] " +
                  " avg iters : %4.2f, avg modularity: %.4f, " +
                  " modularity range [%.4f - %.4f] %n",
                  RUNS, numThreads,
                  bean.getAvgRunTime(),
                  bean.getMinRunTime(),
                  bean.getMaxRunTime(),
                  bean.getAvgIterations(),
                  avgMod/(double) RUNS,
                  minMod, maxMod);
        lpa.shutdown();
    }
View Full Code Here

            // Continue on if we couldn't register this bean, although
            // it's probably a very bad sign
            logger.logThrow(Level.CONFIG, e, "Could not register MBean");
        }
        // Create the LPA algorithm, telling it to use our group finder MBean.
        lpa = new SingleLabelPropagation(this, col, properties, stats);

        int requestedPort = wrappedProps.getIntProperty(
                SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 0, 65535);
        // Export ourself.
        exporter =
View Full Code Here

TOP

Related Classes of com.sun.sgs.impl.service.nodemap.affinity.single.SingleLabelPropagation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.