Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveStatusInfo.cs @ 6521

Last change on this file since 6521 was 6371, checked in by ascheibe, 13 years ago

#1233

  • code cleanups for slave review
  • added switch between privileged and unprivileged sandbox
  • removed childjob management because it's not used
File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Threading;
24
25namespace HeuristicLab.Clients.Hive.SlaveCore {
26  public class SlaveStatusInfo {
27    private static object coreLock = new object();
28    private static int jobsFetched;  // number of fetched jobs
29    private static int jobsStarted;  // number of started jobs
30    private static int jobsFinished; // everything went fine
31    private static int jobsAborted;  // server sent abort
32    private static int jobsFailed;   // jobs that failed in the sandbox
33    private static int exceptionsOccured; // number jobs failed caused by the business logic, not a faulted job
34    private static int usedCores;    // number of cores currently used
35
36    public static DateTime LoginTime { get; set; }
37
38    public static int UsedCores {
39      get { return usedCores; }
40    }
41
42    public static int JobsStarted {
43      get { return jobsStarted; }
44    }
45
46    public static int JobsFinished {
47      get { return jobsFinished; }
48    }
49
50    public static int JobsAborted {
51      get { return jobsAborted; }
52    }
53
54    public static int JobsFetched {
55      get { return jobsFetched; }
56    }
57
58    public static int JobsFailed {
59      get { return jobsFailed; }
60    }
61
62    public static int ExceptionsOccured {
63      get { return exceptionsOccured; }
64    }
65
66    public static void IncrementJobsStarted() {
67      Interlocked.Increment(ref jobsStarted);
68    }
69
70    public static void IncrementJobsFinished() {
71      Interlocked.Increment(ref jobsFinished);
72    }
73
74    public static void IncrementJobsFailed() {
75      Interlocked.Increment(ref jobsFailed);
76    }
77
78    public static void IncrementJobsAborted() {
79      Interlocked.Increment(ref jobsAborted);
80    }
81
82    public static void IncrementJobsFetched() {
83      Interlocked.Increment(ref jobsFetched);
84    }
85
86    public static void IncrementExceptionOccured() {
87      Interlocked.Increment(ref exceptionsOccured);
88    }
89
90    public static void IncrementUsedCores(int val) {
91      Interlocked.Add(ref usedCores, val);
92    }
93
94    public static void DecrementUsedCores(int val) {
95      Interlocked.Add(ref usedCores, -val);
96    }
97  }
98}
Note: See TracBrowser for help on using the repository browser.