package ukmer; import java.util.concurrent.atomic.AtomicInteger; import shared.Shared; import shared.Tools; import structures.SuperLongList; public final class HistogramMakerU { public static long[] fillHistogram(final AbstractKmerTableU[] tables, final int histMax) { if(Shared.threads()>2){ return fillHistogram_MT(tables, histMax); }else{ return fillHistogram_ST(tables, histMax); } } private static long[] fillHistogram_ST(final AbstractKmerTableU[] tables, final int histMax) { long[] ca=new long[histMax+1]; for(AbstractKmerTableU set : tables){ set.fillHistogram(ca, histMax); } return ca; } private static long[] fillHistogram_MT(final AbstractKmerTableU[] tables, final int histMax) { boolean errorState=false; int threads=Shared.threads(); threads=Tools.min((threads>20 ? threads/2 : threads), (tables.length+1)/2, 32); if(threads<2){return fillHistogram_ST(tables, histMax);} final FillThread[] array=new FillThread[threads]; final AtomicInteger next=new AtomicInteger(0); for(int i=0; i