long weightPerThread = Math.max(totalWeight / threads, 1); for (int i = beginIndex; i < endIndex;) { DeltaTask task = new DeltaTask(this); long w = 0; WeightedPath p = topPathItr.next(); w += p.weight; task.add(p.slice); && i == topPaths.get(nextTop).slice.beginIndex) { if (s < i) { task.add(new Slice(s, i)); w += getAdjustedWeight(list[i++]); task.add(new Slice(s, i)); DeltaTask task = new DeltaTask(this); task.add(p.slice); tasks.add(task);
@Override public void run() { try { task.call(); } catch (Throwable failure) { errors.add(failure); } } });
synchronized DeltaWindow stealWork(DeltaTask forThread) { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) { return null; } if (maxTask.tryStealWork(maxSlice)) { return forThread.initWindow(maxSlice); } } }
/** {@inheritDoc} */ @Override public Object call() throws Exception { or = block.templateReader.newReader(); try { DeltaWindow w; for (;;) { synchronized (this) { if (slices.isEmpty()) { break; } w = initWindow(slices.removeFirst()); } runWindow(w); } while ((w = block.stealWork(this)) != null) { runWindow(w); } } finally { block.pm.endWorker(); or.close(); or = null; } return null; }
int cp = beginIndex; int ch = list[cp].getPathHash(); long cw = getAdjustedWeight(list[cp]); totalWeight = cw; cw = 0; int weight = getAdjustedWeight(o); cw += weight; totalWeight += weight;
public Object call() throws Exception { or = block.templateReader.newReader(); try { DeltaWindow w; for (;;) { synchronized (this) { if (slices.isEmpty()) { break; } w = initWindow(slices.removeFirst()); } runWindow(w); } while ((w = block.stealWork(this)) != null) { runWindow(w); } } finally { block.pm.endWorker(); or.close(); or = null; } return null; }
private void singleThreadDeltaSearch(ProgressMonitor monitor, ObjectToPack[] list, int cnt) throws IOException { long totalWeight = 0; for (int i = 0; i < cnt; i++) { ObjectToPack o = list[i]; totalWeight += DeltaTask.getAdjustedWeight(o); } long bytesPerUnit = 1; while (DeltaTask.MAX_METER <= (totalWeight / bytesPerUnit)) bytesPerUnit <<= 10; int cost = (int) (totalWeight / bytesPerUnit); if (totalWeight % bytesPerUnit != 0) cost++; beginPhase(PackingPhase.COMPRESSING, monitor, cost); new DeltaWindow(config, new DeltaCache(config), reader, monitor, bytesPerUnit, list, 0, cnt).search(); endPhase(monitor); }
synchronized DeltaWindow stealWork(DeltaTask forThread) { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) { return null; } if (maxTask.tryStealWork(maxSlice)) { return forThread.initWindow(maxSlice); } } }
long weightPerThread = Math.max(totalWeight / threads, 1); for (int i = beginIndex; i < endIndex;) { DeltaTask task = new DeltaTask(this); long w = 0; WeightedPath p = topPathItr.next(); w += p.weight; task.add(p.slice); && i == topPaths.get(nextTop).slice.beginIndex) { if (s < i) { task.add(new Slice(s, i)); w += getAdjustedWeight(list[i++]); task.add(new Slice(s, i)); DeltaTask task = new DeltaTask(this); task.add(p.slice); tasks.add(task);
/** {@inheritDoc} */ @Override public Object call() throws Exception { or = block.templateReader.newReader(); try { DeltaWindow w; for (;;) { synchronized (this) { if (slices.isEmpty()) { break; } w = initWindow(slices.removeFirst()); } runWindow(w); } while ((w = block.stealWork(this)) != null) { runWindow(w); } } finally { block.pm.endWorker(); or.close(); or = null; } return null; }
int cp = beginIndex; int ch = list[cp].getPathHash(); long cw = getAdjustedWeight(list[cp]); totalWeight = cw; cw = 0; int weight = getAdjustedWeight(o); cw += weight; totalWeight += weight;
public void run() { try { task.call(); } catch (Throwable failure) { errors.add(failure); } } });
synchronized DeltaWindow stealWork(DeltaTask forThread) { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) { return null; } if (maxTask.tryStealWork(maxSlice)) { return forThread.initWindow(maxSlice); } } }
long weightPerThread = Math.max(totalWeight / threads, 1); for (int i = beginIndex; i < endIndex;) { DeltaTask task = new DeltaTask(this); long w = 0; WeightedPath p = topPathItr.next(); w += p.weight; task.add(p.slice); && i == topPaths.get(nextTop).slice.beginIndex) { if (s < i) { task.add(new Slice(s, i)); w += getAdjustedWeight(list[i++]); task.add(new Slice(s, i)); DeltaTask task = new DeltaTask(this); task.add(p.slice); tasks.add(task);
int cp = beginIndex; int ch = list[cp].getPathHash(); long cw = getAdjustedWeight(list[cp]); totalWeight = cw; cw = 0; int weight = getAdjustedWeight(o); cw += weight; totalWeight += weight;
@Override public void run() { try { task.call(); } catch (Throwable failure) { errors.add(failure); } } });
private void singleThreadDeltaSearch(ProgressMonitor monitor, ObjectToPack[] list, int cnt) throws IOException { long totalWeight = 0; for (int i = 0; i < cnt; i++) { ObjectToPack o = list[i]; totalWeight += DeltaTask.getAdjustedWeight(o); } long bytesPerUnit = 1; while (DeltaTask.MAX_METER <= (totalWeight / bytesPerUnit)) bytesPerUnit <<= 10; int cost = (int) (totalWeight / bytesPerUnit); if (totalWeight % bytesPerUnit != 0) cost++; beginPhase(PackingPhase.COMPRESSING, monitor, cost); new DeltaWindow(config, new DeltaCache(config), reader, monitor, bytesPerUnit, list, 0, cnt).search(); endPhase(monitor); }
private void singleThreadDeltaSearch(ProgressMonitor monitor, ObjectToPack[] list, int cnt) throws IOException { long totalWeight = 0; for (int i = 0; i < cnt; i++) { ObjectToPack o = list[i]; totalWeight += DeltaTask.getAdjustedWeight(o); } long bytesPerUnit = 1; while (DeltaTask.MAX_METER <= (totalWeight / bytesPerUnit)) bytesPerUnit <<= 10; int cost = (int) (totalWeight / bytesPerUnit); if (totalWeight % bytesPerUnit != 0) cost++; beginPhase(PackingPhase.COMPRESSING, monitor, cost); new DeltaWindow(config, new DeltaCache(config), reader, monitor, bytesPerUnit, list, 0, cnt).search(); endPhase(monitor); }