@Override @SuppressWarnings("unchecked") public String toString() { int num_ids = this.markovs.size(); Map<String, Object> maps[] = (Map<String, Object>[])new Map<?, ?>[num_ids+1]; int i = 0; maps[i] = new ListOrderedMap<String, Object>(); maps[i].put("Number of Ids", num_ids); for (Integer id : this.markovs.keySet()) { Map<Procedure, MarkovGraph> m = this.markovs.get(id); maps[++i] = new ListOrderedMap<String, Object>(); maps[i].put("ID", "#" + id); maps[i].put("Number of Procedures", m.size()); for (Entry<Procedure, MarkovGraph> e : m.entrySet()) { MarkovGraph markov = e.getValue(); String val = String.format("[Vertices=%d, Recomputed=%d, Accuracy=%.4f]", markov.getVertexCount(), markov.getRecomputeCount(), markov.getAccuracyRatio()); maps[i].put(" " + e.getKey().getName(), val); } // FOR } // FOR return StringUtil.formatMaps(maps); }
/** * Return a string representation of this CatalogType handle * * @param catalog_item * @return */ public static String debug(CatalogType catalog_item) { Map<String, Object> m = new ListOrderedMap<String, Object>(); for (String field : CollectionUtils.union(catalog_item.getFields(), catalog_item.getChildFields())) { String val_str = null; if (catalog_item.getChildFields().contains(field)) { val_str = CatalogUtil.debug(catalog_item.getChildren(field)); } else { Object val = catalog_item.getField(field); if (val != null) { val_str = val.toString(); } else { val_str = "null"; } } m.put(field, val_str); } // FOR return (catalog_item.fullName() + "\n" + StringUtil.formatMaps(m)); }
@Override public String toString() { Map<String, Object> m0 = new ListOrderedMap<String, Object>(); m0.putAll(this.params); Map<String, Object> m1 = null; int opt_cnt = this.opt_params.size(); if (opt_cnt > 0) { Map<String, Object> opt_inner = new ListOrderedMap<String, Object>(); for (int i = 0; i < opt_cnt; i++) { opt_inner.put(String.format("#%02d", i), this.opt_params.get(i)); } m1 = new ListOrderedMap<String, Object>(); m1.put(String.format("Optional Parameters [%d]", opt_cnt), StringUtil.formatMaps(opt_inner)); } return StringUtil.formatMaps(m0, m1); }
@Override public String toString() { Map<String, Object> m = new ListOrderedMap<String, Object>(); m.put("PlanNode Columns", this.planNodeColumns); m.put("PlanNode Hash", Arrays.toString(CollectionUtil.hashCode(this.planNodeColumns.keySet()))); m.put("Table Columns", this.tableColumns); m.put("Column -> PlanColumnGUID", this.column_guid_xref); m.put("PlanColumnGUID -> Column", this.guid_column_xref); m.put("Original Output PlanColumnGUIDs", this.orig_node_output); m.put("JoinPlanNode Tables", this.join_tbl_mapping); m.put("JoinPlanNode Depths", this.join_node_index); m.put("JoinPlanNode Output", this.join_outputs); return (StringUtil.formatMaps(m)); }
@Override public String toString() { Class<?> hints_class = this.getClass(); ListOrderedMap<String, Object> m = new ListOrderedMap<String, Object>(); for (Field f : hints_class.getDeclaredFields()) { String key = f.getName().toUpperCase(); Object val = null; try { val = f.get(this); } catch (IllegalAccessException ex) { val = ex.getMessage(); } m.put(key, val); } // FOR return (StringUtil.formatMaps(m)); }
@Override public String toString() { Map<String, Object> m = new ListOrderedMap<String, Object>(); m.put("Warehouses", parameters.warehouses); m.put("W_ID Range", String.format("[%d, %d]", parameters.starting_warehouse, parameters.last_warehouse)); m.put("Districts per Warehouse", parameters.districtsPerWarehouse); m.put("Custers per District", parameters.customersPerDistrict); m.put("Initial Orders per District", parameters.newOrdersPerDistrict); m.put("Items", parameters.num_items); m.put("Affine Warehouse", lastAssignedWarehouseId); m.put("Skew Factor", this.skewFactor); if (this.zipf != null && this.zipf.isHistoryEnabled()) { m.put("Skewed Warehouses", this.zipf.getHistory()); } return ("TPCC Simulator Options\n" + StringUtil.formatMaps(m, this.config.debugMap())); }
public synchronized void tick(int counter) { this.tick_counter = counter; if (config.warehouse_debug) { Map<String, Histogram<Integer>> m = new ListOrderedMap<String, Histogram<Integer>>(); m.put(String.format("LAST ROUND\n - SampleCount=%d", this.lastWarehouseHistory.getSampleCount()), this.lastWarehouseHistory); m.put(String.format("TOTAL\n - SampleCount=%d", this.totalWarehouseHistory.getSampleCount()), this.totalWarehouseHistory); long total = this.totalWarehouseHistory.getSampleCount(); LOG.info(String.format("ROUND #%02d - Warehouse Temporal Skew - %d / %d [%.2f]\n%s", this.tick_counter, this.temporal_counter, total, (this.temporal_counter / (double)total), StringUtil.formatMaps(m))); LOG.info(StringUtil.SINGLE_LINE); this.lastWarehouseHistory.clearValues(); } }
/** * testIsAlwaysSinglePartition */ public void testIsAlwaysSinglePartition() throws Exception { Map<Procedure, Boolean> expected = new ListOrderedMap<Procedure, Boolean>(); for (int i = 0; i < TARGET_PROCEDURES.length; i++) { expected.put(this.getProcedure(TARGET_PROCEDURES[i]), TARGET_PROCEDURES_SINGLEPARTITION_DEFAULT[i]); } // FOR expected.put(this.getProcedure(UpdateLocation.class), null); assertEquals(TARGET_PROCEDURES.length + 1, expected.size()); // Throw our workload at the costmodel and check that the procedures have the // expected result for whether they are single sited or not SingleSitedCostModel cost_model = new SingleSitedCostModel(catalogContext); cost_model.estimateWorkloadCost(catalogContext, workload); for (Entry<Procedure, Boolean> e : expected.entrySet()) { Boolean sp = cost_model.isAlwaysSinglePartition(e.getKey()); assertEquals(e.getKey().getName(), e.getValue(), sp); } // FOR }
/** * testFormatMaps */ public void testFormatMaps() throws Exception { String key[] = { "This", "is", "a", "key" }; Map<String, Object> m = new ListOrderedMap<String, Object>(); m.put(StringUtil.join(" ", key), rand.nextDouble()); m.put(StringUtil.join("\n", key), rand.nextBoolean()); m.put(Double.toString(rand.nextDouble()), StringUtil.join(" ", key)); m.put(Boolean.toString(rand.nextBoolean()), StringUtil.join("\n", key)); m.put("XXX" + StringUtil.join("\n", key), StringUtil.join("\n", key)); String formatted = StringUtil.formatMaps(m); assertNotNull(formatted); assertFalse(formatted.isEmpty()); System.out.println(formatted); }
@Override public void run() { Map<String, Object> m = new ListOrderedMap<String, Object>(); LOG.info("Starting WatchDogThread"); while (true) { try { Thread.sleep(20000); } catch (InterruptedException ex) { return; } if (testState == null) return; m.clear(); for (Thread t : workerThreads) { m.put(t.getName(), t.isAlive()); } LOG.debug("Worker Thread Status:\n" + StringUtil.formatMaps(m)); } // WHILE }
public Graph(String direction, List<GraphNode> graphNodes, List<GraphEdge> graphEdges, List<GraphProperty> graphProperties) { this.direction = direction; this.graphNodes = graphNodes; nodeIdsToNode = new ListOrderedMap<Long, GraphNode>(); if(!graphNodes.isEmpty()) { for(GraphNode graphNode : graphNodes) { nodeIdsToNode.put(graphNode.getId(), graphNode); } } this.graphEdges = graphEdges; this.graphProperties = graphProperties; }
public void loadFromArgs(String args[]) { if (debug.val) LOG.debug("Loading from commandline input arguments"); final Pattern split_p = Pattern.compile("="); final Map<String, String> argsMap = new ListOrderedMap<String, String>(); for (int i = 0, cnt = args.length; i < cnt; i++) { final String arg = args[i]; final String[] parts = split_p.split(arg, 2); if (parts.length == 1) { LOG.warn("Unexpected argument format '" + arg + "'"); continue; } String k = parts[0].toLowerCase(); String v = parts[1]; if (k.startsWith("-")) k = k.substring(1); // 'hstore.tag' is special argument that we use in killstragglers.py if (k.equalsIgnoreCase("tag")) { continue; // This command is undefined from the commandline } else if (v.startsWith("${")) { continue; // Or this parameter is commented out in Eclipse } else if (k.startsWith("#")) { continue; } // We want it! argsMap.put(k, v); } // FOR this.loadFromArgs(argsMap); }
@Override public String toString() { Map<String, Object> m = new ListOrderedMap<String, Object>(); m.put("DATA", this.data); m.put("COMBO_SIZE", this.combo_size); m.put("NUM_ELEMENTS", this.num_elements); m.put("FINISHED", this.finished); m.put("LAST", this.last); m.put("NEXT", this.next); return StringBoxUtil.box(StringUtil.formatMaps("=", m)); }
public QueryInstance(Statement catalog_stmt, Integer index) { super(catalog_stmt, index); Procedure catalog_proc = (Procedure)catalog_stmt.getParent(); for (StmtParameter catalog_stmt_param : CatalogUtil.getSortedCatalogItems(catalog_stmt.getParameters(), "index")) { Map<ProcParameter, ProcParameterCorrelation> c = new ListOrderedMap<ProcParameter, ProcParameterCorrelation>(); for (ProcParameter catalog_proc_param : CatalogUtil.getSortedCatalogItems(catalog_proc.getParameters(), "index")) { c.put(catalog_proc_param, new ProcParameterCorrelation(catalog_proc_param)); } // FOR this.correlations.put(catalog_stmt_param, c); } // FOR }
/** * Generate a cross-product of * * @param info * @param hints * @param catalog_proc */ public static Map<ProcParameter, Set<MultiProcParameter>> generateMultiProcParameters(final DesignerInfo info, final DesignerHints hints, final Procedure catalog_proc) { List<ProcParameter> params = new ArrayList<ProcParameter>(); Map<ProcParameter, Set<MultiProcParameter>> param_map = new ListOrderedMap<ProcParameter, Set<MultiProcParameter>>(); CollectionUtil.addAll(params, catalog_proc.getParameters()); // Why do I need to make a map like this? for (ProcParameter catalog_param : params) { param_map.put(catalog_param, new HashSet<MultiProcParameter>()); } // FOR for (int i = 0, cnt = params.size(); i < cnt; i++) { ProcParameter param0 = params.get(i); assert (param0 != null); if (param0 instanceof MultiProcParameter || param0.getIsarray()) continue; for (int ii = i + 1; ii < cnt; ii++) { ProcParameter param1 = params.get(ii); assert (param1 != null); if (param1 instanceof MultiProcParameter || param1.getIsarray()) continue; // This will automatically update the Procedure, so there isn't // anything more // we need to do here... MultiProcParameter mpp = MultiProcParameter.get(param0, param1); assert (mpp != null); param_map.get(param0).add(mpp); param_map.get(param1).add(mpp); } // FOR } // FOR return (param_map); }
@SuppressWarnings("unchecked") public String debugHeader(DesignerHints hints) throws Exception { Map<String, Object> m[] = new Map[3]; m[0] = new ListOrderedMap<String, Object>(); m[0].put("Start Time", hints.getStartTime()); m[0].put("Total Time", String.format("%.2f sec", this.total_search_time.getTotalThinkTimeSeconds())); m[0].put("Remaining Time", (hints.limit_total_time != null ? (hints.limit_total_time - this.total_search_time.getTotalThinkTimeSeconds()) + " sec" : "-")); m[0].put("Cost Model", info.getCostModel().getClass().getSimpleName()); m[0].put("# of Transactions", info.workload.getTransactionCount()); m[0].put("# of Partitions", info.catalogContext.numberOfPartitions); m[0].put("# of Intervals", info.getArgs().num_intervals); m[0].put("# of Restarts", (this.restart_ctr != null ? this.restart_ctr : "-")); m[0].put("Database Total Size", StringUtil.formatSize(info.getMemoryEstimator().estimateTotalSize(info.catalogContext.database))); m[0].put("Cluster Total Size", StringUtil.formatSize(info.getNumPartitions() * hints.max_memory_per_partition)); m[1] = new ListOrderedMap<String, Object>(); String fields[] = { "enable_checkpoints", "greedy_search", "relaxation_factor_min", "relaxation_factor_max", "relaxation_factor_min", "back_tracks_multiplier", "local_time_multiplier", "limit_total_time" }; for (String f_name : fields) { Field f = DesignerHints.class.getField(f_name); assert (f != null); m[1].put("hints." + f_name, f.get(hints)); } // FOR m[2] = new ListOrderedMap<String, Object>(); m[2].put(info.workload.getProcedureHistogram().toString(), null); return (StringBoxUtil.box(StringUtil.formatMaps(m), "+")); }
protected String debug(Database catalog_db, Enum<?> elements[]) { Map<String, Object> m = new ListOrderedMap<String, Object>(); try { Class<?> statsClass = this.getClass(); for (Enum<?> element : elements) { Field field = statsClass.getDeclaredField(element.toString().toLowerCase()); Object value = field.get(this); if (field.getClass().isAssignableFrom(SortedMap.class)) { SortedMap<?, ?> orig_value = (SortedMap<?, ?>) value; Map<String, Object> inner_m = new ListOrderedMap<String, Object>(); for (Object inner_key : orig_value.keySet()) { Object inner_val = orig_value.get(inner_key); if (inner_val instanceof AbstractStatistics<?>) { inner_val = ((AbstractStatistics<?>) inner_val).debug(catalog_db); } inner_m.put(inner_key.toString(), inner_val); } // FOR value = StringUtil.formatMaps(inner_m); } m.put(element.toString(), value); } // FOR } catch (Exception ex) { ex.printStackTrace(); System.exit(1); } return (String.format("%s\n%s", this.getCatalogItem(catalog_db), StringUtil.prefix(StringUtil.formatMaps(m), DEBUG_SPACER))); }
@Override public String toString() { Map<String, Object> m = new ListOrderedMap<String, Object>(); for (int i = 0; i < this.dependencies.length; i++) { m.put(Integer.toString(this.depIds[i]), this.dependencies[i].toString()); } // FOR return (StringUtil.formatMaps(m)); }
@Override public String toString() { Map<String, Object> m = new ListOrderedMap<String, Object>(); m.put("Scale Factor", this.scale_factor); m.put("# of Reservations", this.num_reservations); m.put("Flight Start Date", this.flight_start_date); m.put("Flight Upcoming Date", this.flight_upcoming_date); m.put("Flight Past Days", this.flight_past_days); m.put("Flight Future Days", this.flight_future_days); m.put("Num Flights", this.num_flights); m.put("Num Customers", this.num_customers); m.put("Num Reservations", this.num_reservations); return (StringUtil.formatMaps(m)); }
public Map<String, Object> debugMap() { Class<?> confClass = this.getClass(); Map<String, Object> m = new ListOrderedMap<String, Object>(); for (Field f : confClass.getFields()) { Object obj = null; try { obj = f.get(this); } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } m.put(f.getName().toUpperCase(), obj); } // FOR return (m); }
@Override public String toString() { Map<String, Object> m = new ListOrderedMap<String, Object>(); for (CacheType ctype : CACHE_RESERVATIONS.keySet()) { m.put(ctype.name(), CACHE_RESERVATIONS.get(ctype).size()); } // FOR m.put("CACHE_CUSTOMER_BOOKED_FLIGHTS", CACHE_CUSTOMER_BOOKED_FLIGHTS.size()); m.put("CACHE_BOOKED_SEATS", CACHE_BOOKED_SEATS.size()); m.put("PROFILE", this.profile); return StringUtil.formatMaps(m); }
public static void main(String[] vargs) throws Exception { ArgumentsParser args = ArgumentsParser.load(vargs); File csv_path = new File(args.getOptParam(0)); File output_path = new File(args.getOptParam(1)); GenerateHistograms gh = GenerateHistograms.generate(csv_path); Map<String, Object> m = new ListOrderedMap<String, Object>(); m.put("Airport Codes", gh.flights_per_airport.size()); m.put("Airlines", gh.flights_per_airline.getValueCount()); m.put("Departure Times", gh.flights_per_time.getValueCount()); LOG.info(StringUtil.formatMaps(m)); System.err.println(StringUtil.join("\n", gh.flights_per_airport.keySet())); Map<String, Histogram<?>> histograms = new HashMap<String, Histogram<?>>(); histograms.put(SEATSConstants.HISTOGRAM_FLIGHTS_PER_DEPART_TIMES, gh.flights_per_time); // histograms.put(SEATSConstants.HISTOGRAM_FLIGHTS_PER_AIRLINE, gh.flights_per_airline); histograms.put(SEATSConstants.HISTOGRAM_FLIGHTS_PER_AIRPORT, SEATSHistogramUtil.collapseAirportFlights(gh.flights_per_airport)); for (Entry<String, Histogram<?>> e : histograms.entrySet()) { File output_file = new File(output_path.getAbsolutePath() + "/" + e.getKey() + ".histogram"); LOG.info(String.format("Writing out %s data to '%s' [samples=%d, values=%d]", e.getKey(), output_file, e.getValue().getSampleCount(), e.getValue().getValueCount())); e.getValue().save(output_file); } // FOR }
@Override public String toString() { Class<?> confClass = this.getClass(); final Map<String, Object> m0 = new ListOrderedMap<String, Object>(); final Map<String, Object> m1 = new ListOrderedMap<String, Object>(); final Map<String, Object> m2 = new ListOrderedMap<String, Object>(); for (Field f : confClass.getFields()) { String key = f.getName().toUpperCase(); if (key.equalsIgnoreCase("hosts")) { m0.put("Number of Hosts", this.hosts.length); m0.put("Hosts", StringUtil.join("\n", this.hosts)); } else if (key.equalsIgnoreCase("clients")) { m1.put("Number of Clients", this.clients.length); m1.put("Clients", StringUtil.join("\n", this.clients)); } else if (key.equalsIgnoreCase("clientParameters") || key.equalsIgnoreCase("siteParameters")) { // Skip } else { Object val = null; try { val = f.get(this); if (ClassUtil.isArray(val)) val = Arrays.toString((Object[])val); } catch (IllegalAccessException ex) { val = ex.getMessage(); } if ((val instanceof HStoreConf) == false) m2.put(key, val); } } // FOR return (StringUtil.formatMaps(m0, m1, this.clientParameters, this.siteParameters, m2)); }
public String toString() { Map<String, Object> m = new ListOrderedMap<String, Object>(); m.put("Transaction Names", StringUtil.join("\n", transactionNames.keySet())); m.put("Transaction Data", data); // m.put("Workflow Data", wkfdata); m.put("Responses Statuses", basePartitions); if (this.enableBasePartitions) { m.put("Base Partitions", basePartitions); } return "BenchmarkResults\n" + StringUtil.formatMaps(m); }
private Map<String, Object> generateFieldMap(Statement catalog_stmt) { Map<String, Object> m = new ListOrderedMap<String, Object>(); for (String f : catalog_stmt.getFields()) { Object val = catalog_stmt.getField(f); if (f.endsWith("exptree") || f.endsWith("fullplan")) { val = StringUtil.md5sum(val.toString()); } m.put(f, val); } // FOR return (m); }