日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

系统数据监控

發(fā)布時間:2025/3/15 windows 15 豆豆
生活随笔 收集整理的這篇文章主要介紹了 系统数据监控 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

系統(tǒng)數(shù)據(jù)監(jiān)控。

?

?

?

using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using Arch.CFramework.CLoggingAdapter; using Ctrip.Mobile.AppDownload.Utility;namespace Ctrip.Mobile.AppDownload.Service {public class MonitorService : RunningService{public MonitorService(){ElapsedMiliseconds = 3 * 60 * 60 * 1000;//每3小時記錄一次。 s_stopwatch.Start();}public override void LoopLogic(){string info = GetSystemInfo();//Dashboard is better.LoggingManager.Instance().Info("MoniterService", info, new Dictionary<string, string>() { { "SystemInfo", "SystemInfo" } });}Stopwatch s_stopwatch = new Stopwatch();private PerformanceCounter _pc;private static TimeSpan s_lastTotalProcessTime = TimeSpan.Zero;public string GetSystemInfo(){int timeout;int totalThreads;int memory;int workingSetExecludePrivate;int workerThreads;int completionPortThreads;int maxThreadPoolThreads;int maxIOCPThreads;string split = ", ";StringBuilder sbInfo = new StringBuilder();sbInfo.Append(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + split);s_stopwatch.Stop();Process process = Process.GetCurrentProcess();if (_pc == null){_pc = new PerformanceCounter("Process", "Working Set - Private", process.ProcessName);}process.Refresh();totalThreads = process.Threads.Count;memory = (int)((process.WorkingSet64) / (1024 * 1024));workingSetExecludePrivate = (int)(_pc.NextValue() / (1024 * 1024));double elapsedProcessTime = (process.TotalProcessorTime - s_lastTotalProcessTime).TotalMilliseconds;double elapsedSystemTime = s_stopwatch.ElapsedMilliseconds;int cpu = (int)(Math.Round(elapsedProcessTime * 100.0 / elapsedSystemTime / Environment.ProcessorCount));s_lastTotalProcessTime = process.TotalProcessorTime;s_stopwatch.Restart();ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads);ThreadPool.GetMaxThreads(out maxThreadPoolThreads, out maxIOCPThreads);sbInfo.AppendFormat("CPU: {0}, ", cpu < 100 ? cpu : 100);sbInfo.AppendFormat("worker thread: {0}, ", maxThreadPoolThreads - workerThreads);sbInfo.AppendFormat("cpio : {0}, ", maxIOCPThreads - completionPortThreads);sbInfo.AppendFormat("total Threads: {0}, ", totalThreads);sbInfo.AppendFormat("memory(working): {0}MB, ", memory);sbInfo.AppendFormat("memory(private): {0}MB, ", workingSetExecludePrivate);return sbInfo.ToString();}} }

?

轉(zhuǎn)載于:https://www.cnblogs.com/netact/p/3889466.html

總結(jié)

以上是生活随笔為你收集整理的系统数据监控的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。