internal VertexEnqueuedArgs(int threadId, Dataflow.Stage stage, int vertexId, Pointstamp pointstamp) { this.ThreadId = threadId; this.Stage = stage; this.VertexId = vertexId; this.Pointstamp = pointstamp; }
internal bool UpdatePointstampCount(Pointstamp version, Int64 delta) { var oldFrontier = Frontier; var count = 0L; if (!Counts.TryGetValue(version, out count)) { version = new Pointstamp(version); Counts.Add(version, delta); // Potentially add this version to the frontier if (actualFrontier.Add(version)) { Frontier = actualFrontier.Antichain.ToArray(); } } else { if (count + delta == 0) { Counts.Remove(version); if (actualFrontier.Remove(version)) { Frontier = actualFrontier.Antichain.ToArray(); } } else { Counts[version] = count + delta; } } return(Frontier != oldFrontier); }
/// <summary> /// Populates a <see cref="Pointstamp"/> from this epoch. /// </summary> /// <param name="pointstamp">The <see cref="Pointstamp"/> to be populated.</param> /// <returns>The number of coordinates populated (i.e. one).</returns> public int Populate(ref Pointstamp pointstamp) { if (0 < pointstamp.Timestamp.Length) { pointstamp.Timestamp[0] = epoch; } return(1); }
public void BroadcastProgressUpdate(Pointstamp time, int update) { this.consumer.InjectElement(time, 1); if (this.centralizer != null) { this.centralizer.InjectElement(time, update); } }
/// <summary> /// Populates a <see cref="Pointstamp"/> from this timestamp. /// </summary> /// <param name="pointstamp">The <see cref="Pointstamp"/> to be populated.</param> /// <returns>The number of coordinates populated.</returns> public int Populate(ref Pointstamp pointstamp) { var position = outerTime.Populate(ref pointstamp); if (position < pointstamp.Timestamp.Length) { pointstamp.Timestamp[position] = iteration; } return(position + 1); }
public ProgressUpdateBuffer(int name, Runtime.Progress.ProgressUpdateProducer p) { stageID = name; Updates = new Dictionary <T, Int64>(); producer = p; var temp = new Pointstamp(0, new int[] { }); version = new Pointstamp(name, new int[default(T).Populate(ref temp)]); }
public bool Remove(Pointstamp element) { int position = elements.Count; for (int i = 0; i < elements.Count; i++) { if (this.Reachability.LessThan(element, elements.Array[i])) { if (position == elements.Count && element.Equals(elements.Array[i])) { position = i; } else { precedents.Array[i]--; } } } if (position == elements.Count) { throw new Exception("Tried to remove an element not present in MinimalAntichain"); } if (position < elements.Count) { elements.Array[position] = elements.Array[elements.Count - 1]; elements.Count--; precedents.Array[position] = precedents.Array[precedents.Count - 1]; precedents.Count--; } var changes = false; for (int i = 0; i < Antichain.Count; i++) { if (element.Equals(Antichain.Array[i])) { changes = true; } } if (changes) { UpdateAntichain(); } return(changes); }
private void AddToOutstandingRecords(Pointstamp time, Int64 delta) { var count = 0L; if (!outstandingRecords.TryGetValue(time, out count)) { outstandingRecords.Add(new Pointstamp(time), delta); // we want a new time, to avoid capturing the int[] } else { outstandingRecords[time] = count + delta; if (outstandingRecords[time] == 0) { outstandingRecords.Remove(time); } } }
public void UpdateRecordCounts(Pointstamp time, Int64 delta) { Tracing.Trace("(ProdLock"); lock (this) { //if (this.Stage.InternalGraphManager.Controller.Configuration.Impersonation && !this.Stage.InternalGraphManager.Reachability.NoImpersonation.Contains(time.Location) && this.Stage.InternalGraphManager.Reachability.Impersonations[time.Location] != null) //{ // foreach (var newVersion in this.Stage.InternalGraphManager.Reachability.EnumerateImpersonations(time)) // AddToOutstandingRecords(newVersion, delta); // // this.LocalPCS.UpdatePointstampCount(time, delta); //} //else AddToOutstandingRecords(time, delta); } Tracing.Trace(")ProdLock"); }
public bool Add(Pointstamp element) { var newPrecedents = 0; for (int i = 0; i < elements.Count; i++) { if (this.Reachability.LessThan(element, elements.Array[i])) { precedents.Array[i]++; } if (this.Reachability.LessThan(elements.Array[i], element)) { newPrecedents++; } if (this.Reachability.LessThan(element, elements.Array[i]) && this.Reachability.LessThan(elements.Array[i], element) && !elements.Array[i].Equals(element)) { this.Reachability.LessThan(element, elements.Array[i]); throw new Exception("Ordering violation " + element + "," + elements.Array[i]); } } elements.Add(element); precedents.Add(newPrecedents); var changes = newPrecedents == 0; for (int i = 0; i < Antichain.Count; i++) { if (this.Reachability.LessThan(element, Antichain.Array[i])) { changes = true; } } if (changes) { UpdateAntichain(); } return(changes); }
/// <summary> /// Returns a timestamp initialized from the given <paramref name="pointstamp"/>. /// </summary> /// <param name="pointstamp">The pointstamp.</param> /// <param name="length">The number of coordinates to use.</param> /// <returns>The initialized epoch.</returns> public IterationIn <TTime> InitializeFrom(Pointstamp pointstamp, int length) { iteration = pointstamp.Timestamp[length - 1]; outerTime = outerTime.InitializeFrom(pointstamp, length - 1); return(this); }
/// <summary> /// Returns an epoch initialized from the given <paramref name="pointstamp"/>. /// </summary> /// <param name="pointstamp">The pointstamp.</param> /// <param name="length">The number of coordinates to use, which should be <c>1</c>.</param> /// <returns>The initialized epoch.</returns> public Epoch InitializeFrom(Pointstamp pointstamp, int length) { epoch = pointstamp.Timestamp[0]; return(this); }
/// <summary> /// Returns an empty time. /// </summary> /// <param name="pointstamp">Ignored.</param> /// <param name="length">Ignored.</param> /// <returns>An empty time.</returns> public Empty InitializeFrom(Pointstamp pointstamp, int length) { return(new Empty()); }
/// <summary> /// Populates a <see cref="Pointstamp"/> with an empty timestamp. /// </summary> /// <param name="pointstamp">The <see cref="Pointstamp"/> to be populated.</param> /// <returns>The number of coordinates populated (i.e. zero).</returns> public int Populate(ref Pointstamp pointstamp) { return(0); }
public void BroadcastProgressUpdate(Pointstamp time, int update) { this.consumer.InjectElement(time, update); }
public WorkItem(Pointstamp req, Pointstamp cap, Dataflow.Vertex o) { Requirement = req; Capability = cap; Vertex = o; }