/** {@inheritDoc} */ @Override public Collection<Accountable> getChildResources() { return Collections.singleton(Accountables.namedAccountable("file", file)); } }
@Override public Collection<Accountable> getChildResources() { List<Accountable> resources = new ArrayList<>(); resources.addAll(Accountables.namedAccountables("field", fields)); resources.add(Accountables.namedAccountable("delegate", postingsReader)); return Collections.unmodifiableList(resources); }
@Override public Collection<Accountable> getChildResources() { return Collections.singleton(Accountables.namedAccountable("cache", cache)); } }
/** * Returns an accountable with the provided description and bytes. */ public static Accountable namedAccountable(String description, long bytes) { return namedAccountable(description, Collections.<Accountable>emptyList(), bytes); }
@Override public Collection<Accountable> getChildResources() { return Collections.singleton(Accountables.namedAccountable("term vector index", indexReader)); }
@Override public Collection<Accountable> getChildResources() { return Collections.singleton(Accountables.namedAccountable("file", file)); }
@Override public Collection<Accountable> getChildResources() { List<Accountable> resources = new ArrayList<>(); resources.add(Accountables.namedAccountable("global ord deltas", globalOrdDeltas)); resources.add(Accountables.namedAccountable("first segments", firstSegments)); resources.add(Accountables.namedAccountable("segment map", segmentMap)); // TODO: would be nice to return actual child segment deltas too, but the optimizations are confusing return resources; } }
@Override public Collection<Accountable> getChildResources() { return Collections.singleton(Accountables.namedAccountable("stored field index", indexReader)); }
@Override public Collection<Accountable> getChildResources() { if (index == null) { return Collections.emptyList(); } else { return Collections.singleton(Accountables.namedAccountable("term index", index)); } }
@Override public Collection<Accountable> getChildResources() { final List<Accountable> resources = new ArrayList<>(dvProducers.size()); for (Accountable producer : dvProducers) { resources.add(Accountables.namedAccountable("delegate", producer)); } return Collections.unmodifiableList(resources); }
@Override public Collection<Accountable> getChildResources() { List<Accountable> resources = new ArrayList<>(); for(Map.Entry<Integer,BKDReader> ent : readers.entrySet()) { resources.add(Accountables.namedAccountable(readState.fieldInfos.fieldInfo(ent.getKey()).name, ent.getValue())); } return Collections.unmodifiableList(resources); }
/** * Converts a map of resources to a collection. * <p> * The resource descriptions are constructed in this format: * {@code prefix 'key' [toString()]} * <p> * This is a point-in-time type safe view: consumers * will not be able to cast or manipulate the resources in any way. */ public static Collection<Accountable> namedAccountables(String prefix, Map<?,? extends Accountable> in) { List<Accountable> resources = new ArrayList<>(); for (Map.Entry<?,? extends Accountable> kv : in.entrySet()) { resources.add(namedAccountable(prefix + " '" + kv.getKey() + "'", kv.getValue())); } Collections.sort(resources, new Comparator<Accountable>() { @Override public int compare(Accountable o1, Accountable o2) { return o1.toString().compareTo(o2.toString()); } }); return Collections.unmodifiableList(resources); }
@Override public Collection<Accountable> getChildResources() { List<Accountable> resources = new ArrayList<>(); long docBaseDeltaBytes = RamUsageEstimator.shallowSizeOf(docBasesDeltas); for (PackedInts.Reader r : docBasesDeltas) { docBaseDeltaBytes += r.ramBytesUsed(); } resources.add(Accountables.namedAccountable("doc base deltas", docBaseDeltaBytes)); long startPointerDeltaBytes = RamUsageEstimator.shallowSizeOf(startPointersDeltas); for (PackedInts.Reader r : startPointersDeltas) { startPointerDeltaBytes += r.ramBytesUsed(); } resources.add(Accountables.namedAccountable("start pointer deltas", startPointerDeltaBytes)); return Collections.unmodifiableList(resources); }
/** * Augments an existing accountable with the provided description. * <p> * The resource description is constructed in this format: * {@code description [toString()]} * <p> * This is a point-in-time type safe view: consumers * will not be able to cast or manipulate the resource in any way. */ public static Accountable namedAccountable(String description, Accountable in) { return namedAccountable(description + " [" + in + "]", in.getChildResources(), in.ramBytesUsed()); }
resources.add(Accountables.namedAccountable("postings", getPostingsReader())); resources.add(Accountables.namedAccountable("norms", getNormsReader())); resources.add(Accountables.namedAccountable("docvalues", getDocValuesReader())); resources.add(Accountables.namedAccountable("stored fields", getFieldsReader())); resources.add(Accountables.namedAccountable("term vectors", getTermVectorsReader())); resources.add(Accountables.namedAccountable("points", getPointsReader()));
@Override public Collection<Accountable> getChildResources() { return Collections.singleton(Accountables.namedAccountable("reader", reader)); }
@Override public Collection<Accountable> getChildResources() { List<Accountable> resources = new ArrayList<>(); resources.add(Accountables.namedAccountable("offsets", endOffsets)); resources.add(Accountables.namedAccountable("ordinals", ords)); return Collections.unmodifiableCollection(resources); }
@Override public Collection<Accountable> getChildResources() { List<Accountable> resources = new ArrayList<>(); resources.add(Accountables.namedAccountable("ordinals", ordinals)); resources.add(Accountables.namedAccountable("term bytes", bytes)); resources.add(Accountables.namedAccountable("term offsets", termOrdToBytesOffset)); return Collections.unmodifiableList(resources); }
Accountable readRamTree(StreamInput in) throws IOException { final String name = in.readString(); final long bytes = in.readVLong(); int numChildren = in.readVInt(); if (numChildren == 0) { return Accountables.namedAccountable(name, bytes); } List<Accountable> children = new ArrayList(numChildren); while (numChildren-- > 0) { children.add(readRamTree(in)); } return Accountables.namedAccountable(name, children, bytes); }
private void fillSegmentInfo(SegmentReader segmentReader, boolean verbose, boolean search, Map<String, Segment> segments) { SegmentCommitInfo info = segmentReader.getSegmentInfo(); assert segments.containsKey(info.info.name) == false; Segment segment = new Segment(info.info.name); segment.search = search; segment.docCount = segmentReader.numDocs(); segment.delDocCount = segmentReader.numDeletedDocs(); segment.version = info.info.getVersion(); segment.compound = info.info.getUseCompoundFile(); try { segment.sizeInBytes = info.sizeInBytes(); } catch (IOException e) { logger.trace(() -> new ParameterizedMessage("failed to get size for [{}]", info.info.name), e); } segment.memoryInBytes = segmentReader.ramBytesUsed(); segment.segmentSort = info.info.getIndexSort(); if (verbose) { segment.ramTree = Accountables.namedAccountable("root", segmentReader); } segment.attributes = info.info.getAttributes(); // TODO: add more fine grained mem stats values to per segment info here segments.put(info.info.name, segment); }