public static Counters NewCounters() { Counters hc = new Counters(); foreach (JobCounter c in JobCounter.Values()) { hc.FindCounter(c).SetValue((long)(Math.Random() * 1000)); } foreach (TaskCounter c_1 in TaskCounter.Values()) { hc.FindCounter(c_1).SetValue((long)(Math.Random() * 1000)); } int nc = FileSystemCounter.Values().Length * 4; for (int i = 0; i < nc; ++i) { foreach (FileSystemCounter c_2 in FileSystemCounter.Values()) { hc.FindCounter(FsSchemes.Next(), c_2).SetValue((long)(Math.Random() * Dt)); } } for (int i_1 = 0; i_1 < 2 * 3; ++i_1) { hc.FindCounter(UserCounterGroups.Next(), UserCounters.Next()).SetValue((long)(Math .Random() * 100000)); } return(hc); }
public async Task <int> GetNextSequence(CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); var today = DateTime.UtcNow.Date; var jobCounterSpec = new JobCounterFilterSpecification(today); var todaysCounter = await _jobCounterRepository.GetSingleBySpec(jobCounterSpec, cancellationToken); if (todaysCounter == null) { todaysCounter = new JobCounter { Date = today, Count = 1 }; await _jobCounterRepository.Create(todaysCounter, cancellationToken); } else { todaysCounter.Count++; await _jobCounterRepository.Update(todaysCounter, cancellationToken); } return(todaysCounter.Count); }
public MoneroJob(int id, GetBlockTemplateResponse blockTemplate, byte[] instanceId) { Id = id; BlockTemplate = blockTemplate; _workerJobCounter = new JobCounter(); PrepareBlobTemplate(instanceId); }
public MoneroJobManager() { _logger = Log.ForContext <MoneroJobManager>().ForContext("Pool", "XMR"); _jobCounter = new JobCounter(); using (var rng = RandomNumberGenerator.Create()) { instanceId = new byte[MoneroConstants.InstanceIdSize]; rng.GetNonZeroBytes(instanceId); } }
public IEnumerator ShiftAndRefillAll() { var jobCounter = new JobCounter(true); for (int col = 0; col < HexagonDatabase.Instance.HexagonGrid.GetLength(0); col++) { // count empty cells int shiftCount = 0; for (int row = 0; row < HexagonDatabase.Instance.HexagonGrid.GetLength(1); row++) { var hex = HexagonDatabase.Instance.HexagonGrid[col, row]; if (!hex) { // empty cell: count shiftCount++; } else { if (shiftCount > 0) { // full cell: shift jobCounter.JobStarted(); StartCoroutine(Shift(col, row, shiftCount, hex, jobCounter.JobFinished)); } } } var rowLength = HexagonDatabase.Instance.HexagonGrid.GetLength(1); var refillSpawnRow = rowLength + 2; // refill. The amount is exactly <shiftCount>. for (var row = rowLength - shiftCount; row < rowLength; row++) { jobCounter.JobStarted(); StartCoroutine(Refill(col, row, refillSpawnRow, jobCounter.JobFinished)); } } jobCounter.PermitCompletion(); yield return(new WaitUntil(() => jobCounter.IsCompleted)); }
public void WriteSourceFileInfo(Data data, string section) { data.SetValue(section + "DocumentTitle", DocumentTitle); data.SetValue(section + "WinStation", WinStation); data.SetValue(section + "Username", Author); data.SetValue(section + "ClientComputer", ClientComputer); data.SetValue(section + "SpoolFileName", Filename); data.SetValue(section + "PrinterName", PrinterName); data.SetValue(section + "SessionId", SessionId.ToString(CultureInfo.InvariantCulture)); data.SetValue(section + "JobCounter", JobCounter.ToString(CultureInfo.InvariantCulture)); data.SetValue(section + "JobId", JobId.ToString(CultureInfo.InvariantCulture)); var type = Type == JobType.XpsJob ? "xps" : "ps"; data.SetValue(section + "SourceFileType", type); data.SetValue(section + "Copies", Copies.ToString(CultureInfo.InvariantCulture)); data.SetValue(section + "TotalPages", TotalPages.ToString(CultureInfo.InvariantCulture)); }
public JobCounterTests() { _jobCounter = new JobCounter(); }