Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveStatusInfo.cs @ 14064

Last change on this file since 14064 was 12012, checked in by ascheibe, 10 years ago

#2212 merged r12008, r12009, r12010 back into trunk

File size: 2.7 KB
RevLine 
[6983]1#region License Information
2/* HeuristicLab
[12012]3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[6983]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 usedCores;    // number of cores currently used
34
35    public static DateTime LoginTime { get; set; }
36
37    public static int UsedCores {
38      get { return usedCores; }
39    }
40
41    public static int TasksStarted {
42      get { return tasksStarted; }
43    }
44
45    public static int TasksFinished {
46      get { return tasksFinished; }
47    }
48
49    public static int TasksAborted {
50      get { return tasksAborted; }
51    }
52
53    public static int TasksFetched {
54      get { return tasksFetched; }
55    }
56
57    public static int TasksFailed {
58      get { return tasksFailed; }
59    }
60
61    public static void IncrementTasksStarted() {
62      Interlocked.Increment(ref tasksStarted);
63    }
64
65    public static void IncrementTasksFinished() {
66      Interlocked.Increment(ref tasksFinished);
67    }
68
69    public static void IncrementTasksFailed() {
70      Interlocked.Increment(ref tasksFailed);
71    }
72
73    public static void IncrementTasksAborted() {
74      Interlocked.Increment(ref tasksAborted);
75    }
76
77    public static void IncrementTasksFetched() {
78      Interlocked.Increment(ref tasksFetched);
79    }
80
81    public static void IncrementUsedCores(int val) {
82      Interlocked.Add(ref usedCores, val);
83    }
84
85    public static void DecrementUsedCores(int val) {
86      Interlocked.Add(ref usedCores, -val);
87    }
88  }
89}
Note: See TracBrowser for help on using the repository browser.