internal long AddEntry( long pipelineId, string cmdline, PipelineState status, DateTime startTime, DateTime endTime, bool skipIfLocked) { using (History._trace.TraceMethod()) { if (!Monitor.TryEnter(this._syncRoot, skipIfLocked ? 0 : -1)) { return(-1); } try { this.ReallocateBufferIfNeeded(); HistoryInfo entry = new HistoryInfo(pipelineId, cmdline, status, startTime, endTime); long id = this.Add(entry); entry.SetId(id); return(id); } finally { Monitor.Exit(this._syncRoot); } } }
private long Add(HistoryInfo entry) { using (History._trace.TraceMethod()) { this._buffer[this.GetIndexForNewEntry()] = entry != null ? entry : throw History._trace.NewArgumentNullException(nameof(entry)); ++this._countEntriesAdded; entry.SetId(this._countEntriesAdded); this.IncrementCountOfEntriesInBuffer(); return(this._countEntriesAdded); } }
private long Add(HistoryInfo entry) { if (entry == null) { throw PSTraceSource.NewArgumentNullException("entry"); } this._buffer[this.GetIndexForNewEntry()] = entry; this._countEntriesAdded += 1L; entry.SetId(this._countEntriesAdded); this.IncrementCountOfEntriesInBuffer(); return(this._countEntriesAdded); }
private long Add(HistoryInfo entry) { if (entry == null) { throw PSTraceSource.NewArgumentNullException("entry"); } this._buffer[this.GetIndexForNewEntry()] = entry; this._countEntriesAdded += 1L; entry.SetId(this._countEntriesAdded); this.IncrementCountOfEntriesInBuffer(); return this._countEntriesAdded; }
/// <summary> /// Adds an entry to the buffer. If buffer is full, overwrites /// oldest entry in the buffer /// </summary> /// <param name="entry"></param> /// <returns>Returns id for the entry. This id should be used to fetch /// the entry from the buffer</returns> /// <remarks>Id starts from 1 and is incremented by 1 for each new entry</remarks> private long Add(HistoryInfo entry) { if (entry == null) { throw PSTraceSource.NewArgumentNullException("entry"); } _buffer[GetIndexForNewEntry()] = entry; //Increment count of entries added so far _countEntriesAdded++; //Id of an entry in history is same as its number in history store. entry.SetId(_countEntriesAdded); //Increment count of entries in buffer by 1 IncrementCountOfEntriesInBuffer(); return _countEntriesAdded; }