Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/SlaveStatusInfo.cs @ 9674

Last change on this file since 9674 was 7259, checked in by swagner, 13 years ago

Updated year of copyrights to 2012 (#1716)

File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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 tasksFetched;  // number of fetched jobs
29    private static int tasksStarted;  // number of started jobs
30    private static int tasksFinished; // everything went fine
31    private static int tasksAborted;  // server sent abort
32    private static int tasksFailed;   // tasks that failed in the sandbox
33    private static int exceptionsOccured; // number jobs failed caused by the business logic, not a faulted task
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 TasksStarted {
43      get { return tasksStarted; }
44    }
45
46    public static int TasksFinished {
47      get { return tasksFinished; }
48    }
49
50    public static int TasksAborted {
51      get { return tasksAborted; }
52    }
53
54    public static int TasksFetched {
55      get { return tasksFetched; }
56    }
57
58    public static int TasksFailed {
59      get { return tasksFailed; }
60    }
61
62    public static int ExceptionsOccured {
63      get { return exceptionsOccured; }
64    }
65
66    public static void IncrementTasksStarted() {
67      Interlocked.Increment(ref tasksStarted);
68    }
69
70    public static void IncrementTasksFinished() {
71      Interlocked.Increment(ref tasksFinished);
72    }
73
74    public static void IncrementTasksFailed() {
75      Interlocked.Increment(ref tasksFailed);
76    }
77
78    public static void IncrementTasksAborted() {
79      Interlocked.Increment(ref tasksAborted);
80    }
81
82    public static void IncrementTasksFetched() {
83      Interlocked.Increment(ref tasksFetched);
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.