#region License Information /* HeuristicLab * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Threading; namespace HeuristicLab.Clients.Hive.SlaveCore { public class SlaveStatusInfo { private static object coreLock = new object(); private static int jobsFetched; // number of fetched jobs private static int jobsStarted; // number of started jobs private static int jobsFinished; // everything went fine private static int jobsAborted; // server sent abort private static int jobsFailed; // jobs that failed in the sandbox private static int exceptionsOccured; // number jobs failed caused by the business logic, not a faulted job private static int usedCores; // number of cores currently used public static DateTime LoginTime { get; set; } public static int UsedCores { get { return usedCores; } } public static int JobsStarted { get { return jobsStarted; } } public static int JobsFinished { get { return jobsFinished; } } public static int JobsAborted { get { return jobsAborted; } } public static int JobsFetched { get { return jobsFetched; } } public static int JobsFailed { get { return jobsFailed; } } public static int ExceptionsOccured { get { return exceptionsOccured; } } public static void IncrementJobsStarted() { Interlocked.Increment(ref jobsStarted); } public static void IncrementJobsFinished() { Interlocked.Increment(ref jobsFinished); } public static void IncrementJobsFailed() { Interlocked.Increment(ref jobsFailed); } public static void IncrementJobsAborted() { Interlocked.Increment(ref jobsAborted); } public static void IncrementJobsFetched() { Interlocked.Increment(ref jobsFetched); } public static void IncrementExceptionOccured() { Interlocked.Increment(ref exceptionsOccured); } public static void IncrementUsedCores(int val) { Interlocked.Add(ref usedCores, val); } public static void DecrementUsedCores(int val) { Interlocked.Add(ref usedCores, -val); } } }