public final static void runner(ReadGraphImpl graph, final int r1, final int r2, CacheEntry parent, ListenerBase listener, final IntProcedure procedure) {
if(parent == null && listener == null) {
+ if(Development.DEVELOPMENT)
+ Development.recordHistogram(new Objects(r1, r2).toString());
+
Objects.computeForEach(graph, r1, r2, null, procedure);
return;
}
entry.clearResult(processor.querySupport);
entry.putEntry(processor);
+ if(Development.DEVELOPMENT)
+ Development.recordHistogram(entry.toString());
+
processor.performForEach(graph, entry, parent, listener, procedure);
} else {
for(Pair<String,Integer> entry : entries) {
b.println(entry.first + ": " + entry.second);
+ Exception e = Development.histogramExceptions.get(entry.first);
+ if (e != null) {
+ e.printStackTrace(b);
+ }
}
b.close();
import org.simantics.db.impl.procedure.TripleIntProcedureAdapter;
import org.simantics.db.procedure.ListenerBase;
import org.simantics.db.request.RequestFlags;
+import org.simantics.utils.Development;
final public class Statements extends CollectionBinaryQuery<TripleIntProcedure> {
entry.clearResult(processor.querySupport);
entry.putEntry(processor);
+ if(Development.DEVELOPMENT)
+ Development.recordHistogram(entry.toString());
+
processor.performForEach(graph, entry, parent, listener, procedure);
} else {
assert(r2 != 0);
if(parent == null && listener == null) {
+ if(Development.DEVELOPMENT)
+ Development.recordHistogram(new Statements(r1, r2).toString());
Statements.computeForEach(graph, r1, r2, null, procedure);
return;
}
throw new Error("Not supported.");
}
+ @Override
+ public String toString() {
+ return "ClusterBig[" + getClusterId() + "]";
+ }
+
public int makeResourceKey(int resourceIndex) throws DatabaseException {
int key = 0;
// if (ClusterTraitsBase.isIllegalResourceIndex(resourceIndex))
private static final Logger LOGGER = LoggerFactory.getLogger(Development.class);
public static TreeMap<String,Integer> histogram = new TreeMap<>();
+ public static Map<String, Exception> histogramExceptions = new HashMap<>();
public static final boolean DEVELOPMENT = false;
-
+ private static final int histogramExceptionThreshold = 100;
+
public static final String PRINT = "Development.print";
public interface DevelopmentListener {
String key = o.toString();
Integer i = histogram.get(key);
histogram.put(key, i == null ? 1 : i+1);
+ if (i != null && i >= histogramExceptionThreshold) {
+ histogramExceptions.computeIfAbsent(key, k -> new Exception());
+ }
}
}