Exemplo n.º 1
0
        /**
         * <summary>
         * Convert the map representation of the cache metrics to an equivalent objects.</summary>
         *
         * <param name="data">Map of raw cache metrics.</param>
         * <returns>Converted cache metrics.</returns>
         */
        protected IGridClientDataMetrics parseCacheMetrics(IDictionary <String, Object> data)
        {
            var m = new GridClientDataMetrics();

            m.CreateTime = U.Timestamp(asLong(data["createTime"]));
            m.WriteTime  = U.Timestamp(asLong(data["writeTime"]));
            m.ReadTime   = U.Timestamp(asLong(data["readTime"]));
            m.Reads      = asLong(data["reads"]);
            m.Writes     = asLong(data["writes"]);
            m.Hits       = asLong(data["hits"]);
            m.Misses     = asLong(data["misses"]);

            return(m);
        }
Exemplo n.º 2
0
        /**
         * <summary>
         * Convert the map representation of the node metrics to an equivalent objects.</summary>
         *
         * <param name="data">Map of raw node metrics.</param>
         * <returns>Converted node metrics.</returns>
         */
        protected IGridClientNodeMetrics parseNodeMetrics(IDictionary <String, Object> data)
        {
            GridClientNodeMetrics m = new GridClientNodeMetrics();

            m.StartTime = U.Timestamp(safeLong(data, "startTime"));

            m.WaitingJobs.Average = safeDouble(data, "averageWaitingJobs");
            m.WaitingJobs.Current = safeLong(data, "currentWaitingJobs");
            m.WaitingJobs.Maximum = safeLong(data, "maximumWaitingJobs");
            m.WaitingJobs.Total   = m.WaitingJobs.Maximum;

            m.ExecutedJobs.Average = safeDouble(data, "averageActiveJobs");
            m.ExecutedJobs.Current = safeLong(data, "currentActiveJobs");
            m.ExecutedJobs.Maximum = safeLong(data, "maximumActiveJobs");
            m.ExecutedJobs.Total   = safeLong(data, "totalExecutedJobs");

            m.RejectedJobs.Average = safeDouble(data, "averageRejectedJobs");
            m.RejectedJobs.Current = safeLong(data, "currentRejectedJobs");
            m.RejectedJobs.Maximum = safeLong(data, "maximumRejectedJobs");
            m.RejectedJobs.Total   = safeLong(data, "totalRejectedJobs");

            m.CancelledJobs.Average = safeDouble(data, "averageCancelledJobs");
            m.CancelledJobs.Current = safeLong(data, "currentCancelledJobs");
            m.CancelledJobs.Maximum = safeLong(data, "maximumCancelledJobs");
            m.CancelledJobs.Total   = safeLong(data, "totalCancelledJobs");

            m.JobWaitTime.Average = TimeSpan.FromMilliseconds(safeDouble(data, "averageJobWaitTime"));
            m.JobWaitTime.Current = TimeSpan.FromMilliseconds(safeDouble(data, "currentJobWaitTime"));
            m.JobWaitTime.Maximum = TimeSpan.FromMilliseconds(safeDouble(data, "maximumJobWaitTime"));
            m.JobWaitTime.Total   = TimeSpan.FromMilliseconds(m.JobWaitTime.Average.TotalMilliseconds * m.ExecutedJobs.Total);

            m.JobExecuteTime.Average = TimeSpan.FromMilliseconds(safeDouble(data, "averageJobExecuteTime"));
            m.JobExecuteTime.Current = TimeSpan.FromMilliseconds(safeDouble(data, "currentJobExecuteTime"));
            m.JobExecuteTime.Maximum = TimeSpan.FromMilliseconds(safeDouble(data, "maximumJobExecuteTime"));
            m.JobExecuteTime.Total   = TimeSpan.FromMilliseconds(m.JobExecuteTime.Average.TotalMilliseconds * m.ExecutedJobs.Total);

            m.StartTime      = U.Timestamp(safeLong(data, "startTime"));
            m.NodeStartTime  = U.Timestamp(safeLong(data, "nodeStartTime"));
            m.UpTime         = TimeSpan.FromMilliseconds(safeLong(data, "upTime"));
            m.LastUpdateTime = U.Timestamp(safeLong(data, "lastUpdateTime"));
            m.IdleTimeTotal  = TimeSpan.FromMilliseconds(safeLong(data, "totalIdleTime"));
            //m.IdleTimeCurrent = (safeLong(data, "currentIdleTime"));

            m.CpuCount       = (int)safeLong(data, "totalCpus");
            m.CpuAverageLoad = safeDouble(data, "averageCpuLoad");
            m.CpuCurrentLoad = safeLong(data, "currentCpuLoad");

            m.FileSystemFreeSpace   = safeLong(data, "fileSystemFreeSpace");
            m.FileSystemTotalSpace  = safeLong(data, "fileSystemTotalSpace");
            m.FileSystemUsableSpace = safeLong(data, "fileSystemUsableSpace");

            m.HeapMemoryInitialized = safeLong(data, "heapMemoryInitialized");
            m.HeapMemoryUsed        = safeLong(data, "heapMemoryUsed");
            m.HeapMemoryCommitted   = safeLong(data, "heapMemoryCommitted");
            m.HeapMemoryMaximum     = safeLong(data, "heapMemoryMaximum");

            m.NonHeapMemoryInitialized = safeLong(data, "nonHeapMemoryInitialized");
            m.NonHeapMemoryUsed        = safeLong(data, "nonHeapMemoryUsed");
            m.NonHeapMemoryCommitted   = safeLong(data, "nonHeapMemoryCommitted");
            m.NonHeapMemoryMaximum     = safeLong(data, "nonHeapMemoryMaximum");

            m.ThreadCount.Current = safeLong(data, "currentThreadCount");
            m.ThreadCount.Maximum = safeLong(data, "maximumThreadCount");
            m.ThreadCount.Total   = safeLong(data, "totalStartedThreadCount");

            m.DaemonThreadCount = safeLong(data, "currentDaemonThreadCount");

            m.LastDataVersion = safeLong(data, "lastDataVersion");

            return(m);
        }