コード例 #1
0
ファイル: StatusUpdateTask.cs プロジェクト: withlin/cat.net
        public StatusUpdateTask(IMessageStatistics mStatistics, AbstractClientConfig c)
        {
            try
            {
                _mStatistics   = mStatistics;
                config         = c;
                currentProcess = Process.GetCurrentProcess();

                Assembly executingAssembly = Assembly.GetExecutingAssembly();
                fileVersion = FileVersionInfo.GetVersionInfo(executingAssembly.Location).FileVersion.ToString();

                physicalMemory = GetPhysicalMemory();

                if (null != currentProcess)
                {
                    startTime = MilliSecondTimer.ToUnixMilliSeconds(currentProcess.StartTime);
                }

                dotNetVersion = Environment.Version.ToString();

                if (null != currentProcess)
                {
                    userName = currentProcess.StartInfo.UserName;
                }

                arch = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");

                ntVersion = Environment.OSVersion.Version.Major + "." + Environment.OSVersion.Version.Minor;

                processorCount = Environment.ProcessorCount;

#if NETFULL
                perfMetricProvider = new DefaultPerformanceMetricProvider();
                perfMetricProvider.Initialize();
#endif
            }
            catch (Exception ex) { Cat.lastException = ex; }
        }
コード例 #2
0
 public DefaultPerformanceMetricProvider()
 {
     startTime = MilliSecondTimer.ToUnixMilliSeconds(currentProcess.StartTime);
 }