Package edu.brown.utils

Examples of edu.brown.utils.ArgumentsParser


    /**
     * @param vargs
     * @throws Exception
     */
    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        args.require(ArgumentsParser.PARAM_CATALOG, ArgumentsParser.PARAM_CATALOG_OUTPUT);

        Catalog catalog = args.catalog;
        File output = args.getFileParam(ArgumentsParser.PARAM_CATALOG_OUTPUT);
        new CatalogExporter(catalog).save(output);
    }
View Full Code Here


    /**
     * Tester
     * @param args
     */
    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        args.require(
            ArgumentsParser.PARAM_CATALOG,
            ArgumentsParser.PARAM_WORKLOAD,
            ArgumentsParser.PARAM_MAPPINGS_OUTPUT
        );
        LOG.info("Starting " + MappingCalculator.class.getSimpleName());
        if (debug.val)
            LOG.debug("Workload Procedures Distribution:\n" + args.workload.getProcedureHistogram());
       
        MappingCalculator cc = new MappingCalculator(args.catalog_db);
        int ctr = 0;
        for (AbstractTraceElement<?> element : args.workload) {
            if (element instanceof TransactionTrace) {
                try {
                    cc.processTransaction((TransactionTrace)element);
                } catch (Exception ex) {
                    throw new Exception("Failed to process " + element, ex);
                }
                ctr++;
            }
        } // FOR
        LOG.info("Finished processing " + ctr + " TransactionTraces. Now calculating correlation coeffcients...");
        cc.calculate();
       
//        System.err.println("Dumping out correlations...");
//       
//        for (Procedure catalog_proc : args.catalog_db.getProcedures()) {
//            if (!catalog_proc.getName().equals("neworder")) continue;
//            System.err.println(cc.getProcedureCorrelations(catalog_proc));
//        } // FOR
       
        double threshold = 1.0d;
        if (args.hasDoubleParam(ArgumentsParser.PARAM_MAPPINGS_THRESHOLD)) {
            threshold = args.getDoubleParam(ArgumentsParser.PARAM_MAPPINGS_THRESHOLD);
        }
        ParameterMappingsSet pc = cc.getParameterMappings(threshold);
        File output_path = args.getFileParam(ArgumentsParser.PARAM_MAPPINGS_OUTPUT);
        assert(!pc.isEmpty());
        if (debug.val) LOG.debug("DEBUG DUMP:\n" + pc.debug());
        pc.save(output_path);
        LOG.info(String.format("Wrote %s to '%s'", pc.getClass().getSimpleName(), output_path));
    }
View Full Code Here

     *
     * @param catalog
     * @param catalog_path
     */
    public CatalogViewer(Catalog catalog, String catalog_path) {
        super(new ArgumentsParser(), WINDOW_TITLE);
        this.catalog = catalog;
        this.catalog_path = catalog_path;
        this.menuHandler = new CatalogViewer.MenuHandler();
        this.init();
    }
View Full Code Here

   
    /**
     * @param args
     */
    public static void main(final String[] vargs) throws Exception {
        final ArgumentsParser args = ArgumentsParser.load(vargs);
        args.require(ArgumentsParser.PARAM_CATALOG);
       
//        Procedure catalog_proc = args.catalog_db.getProcedures().get("slev");
//        Statement catalog_stmt = catalog_proc.getStatements().get("GetStockCount");
//        String jsonString = Encoder.hexDecodeToString(catalog_stmt.getMs_fullplan());
//        JSONObject jsonObject = new JSONObject(jsonString);
View Full Code Here

    /**
     * @param args
     */
    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        args.require(ArgumentsParser.PARAM_CATALOG);

//        if (args.hasParam(ArgumentsParser.PARAM_WORKLOAD)) {
//            m.put("Complexity", complexity(args, args.catalog_db, args.workload));
//        }
       
View Full Code Here

            throw new RuntimeException(ex);
        }
    }
   
    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        args.require(ArgumentsParser.PARAM_CATALOG);
       
        DependencyGraph dgraph = DependencyGraphGenerator.generate(args.catalogContext);
        GraphUtil.removeDuplicateEdges(dgraph);
       
        // Any optional parameters are tables we should ignore
        // To do that we need to just remove them from the DependencyGraph
        for (String opt : args.getOptParams()) {
            for (String tableName : opt.split(",")) {
                Table catalog_tbl = args.catalog_db.getTables().getIgnoreCase(tableName);
                if (catalog_tbl == null) {
                    LOG.warn("Unknown table '" + tableName + "'");
                    continue;
                }
                DesignerVertex v = dgraph.getVertex(catalog_tbl);
                assert(v != null) : "Failed to get vertex for " + catalog_tbl;
                dgraph.removeVertex(v);
            } // FOR
        } // FOR
       
        GraphvizExport<DesignerVertex, DesignerEdge> gvx = new GraphvizExport<DesignerVertex, DesignerEdge>(dgraph);
       
        // Enable full edge labels
        if (args.getBooleanParam(ArgumentsParser.PARAM_CATALOG_LABELS, false)) {
            gvx.setEdgeLabels(true);
            DependencyUtil dependUtil = DependencyUtil.singleton(args.catalog_db);
            for (DesignerEdge e : dgraph.getEdges()) {
                Table tbl0 = dgraph.getSource(e).getCatalogItem();
                Table tbl1 = dgraph.getDest(e).getCatalogItem();
View Full Code Here

    /**
     * @param args
     */
    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        assert (args.hasParam(ArgumentsParser.PARAM_CATALOG_OUTPUT));
        String output_path = args.getParam(ArgumentsParser.PARAM_CATALOG_OUTPUT);

        Procedure source_proc = args.catalog_db.getProcedures().get("neworderMultiSite");
        assert (source_proc != null);
        Procedure target_proc = args.catalog_db.getProcedures().get("neworder");
        assert (target_proc != null);
View Full Code Here

        assert (generator != null);
        return (generator);
    }

    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        args.require(ArgumentsParser.PARAM_CATALOG_TYPE, ArgumentsParser.PARAM_STATS_SCALE_FACTOR, ArgumentsParser.PARAM_STATS_OUTPUT);

        double scale_factor = args.getDoubleParam(ArgumentsParser.PARAM_STATS_SCALE_FACTOR);
        File output = args.getFileParam(ArgumentsParser.PARAM_STATS_OUTPUT);

        AbstractTableStatisticsGenerator generator = factory(args.catalog_db, args.catalog_type, scale_factor);
        Map<Table, TableStatistics> table_stats = generator.generate();
        assert (table_stats != null);
        WorkloadStatistics stats = new WorkloadStatistics(args.catalog_db);
View Full Code Here

    public void fromJSON(JSONObject json_object, Database catalog_db) throws JSONException {
        JSONUtil.fieldsFromJSON(json_object, catalog_db, this, EstimationThresholds.class, EstimationThresholds.Members.values());
    }
   
    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        assert(args != null);
        EstimationThresholds et = new EstimationThresholds();
        System.out.println(et.toJSONString());
    }
View Full Code Here

     * Constructor
     *
     * @param args
     */
    public DesignerInfo(final CatalogContext _catalogContext, final Workload _workload, final WorkloadStatistics _stats) {
        this(new ArgumentsParser() {
            {
                this.catalogContext = _catalogContext;
                this.catalog_db = _catalogContext.database;
                this.workload = _workload;
                this.stats = _stats;
View Full Code Here

TOP

Related Classes of edu.brown.utils.ArgumentsParser

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.