zoukankan      html  css  js  c++  java
  • Asp.net获取系统信息

            [DllImport("kernel32")]
            public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo);


            [StructLayout(LayoutKind.Sequential)]
            public struct MEMORY_INFO
            {
                public uint dwLength;
                public uint dwMemoryLoad;
                public uint dwTotalPhys;
                public uint dwAvailPhys;
                public uint dwTotalPageFile;
                public uint dwAvailPageFile;
                public uint dwTotalVirtual;
                public uint dwAvailVirtual;
            }


            protected string MemberName, AdminLevel, MemoryLoad, TotalPhys, AvailPhys, TotalPageFile, AvailPageFile, TotalVirtual;
            protected string ServerOS, CpuSum, CpuType, MachineName, ServerName, ServerPath, ServerNet, ServerArea, ServerTimeOut, ServerStart, UsersTxt;
            protected string PrStart, AspNetN, AspNetCpu, ServerSessions, ServerApp, ServerCache, ServerAppN, ServerFso, RunTime, SessionTime, VersionTxt;
            protected string SiteTitle, SiteUrl;
           
            protected void Page_Load(object sender, EventArgs e)
            {

                this.CheckPower();

                if (this.adminer != null)
                {
                    DataLoad();
                }
            }


            private void DataLoad()
            {
                DateTime sTime = DateTime.Now;

                MemberName = "";

                ServerOS = Environment.OSVersion.ToString();
                CpuSum = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");
                CpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");
                MachineName = Server.MachineName;
                ServerName = Request.ServerVariables["SERVER_NAME"];
                ServerPath = Request.ServerVariables["APPL_PHYSICAL_PATH"];
                ServerNet = ".NET CLR " + Environment.Version.ToString();
                ServerArea = (DateTime.Now - DateTime.UtcNow).TotalHours > 0 ? "+" + (DateTime.Now - DateTime.UtcNow).TotalHours.ToString() : (DateTime.Now - DateTime.UtcNow).TotalHours.ToString();
                ServerTimeOut = Server.ScriptTimeout.ToString();
                ServerStart = ((Double)System.Environment.TickCount / 3600000).ToString("N2");
                PrStart = GetPrStart();
                AspNetN = GetAspNetN();
                AspNetCpu = GetAspNetCpu();
                ServerSessions = Session.Contents.Count.ToString();
                ServerApp = Application.Contents.Count.ToString();
                ServerCache = Cache.Count.ToString();
                ServerAppN = GetServerAppN();
                ServerFso = Check("Scripting.FileSystemObject");
                ServerTimeOut = Server.ScriptTimeout.ToString() + "毫秒";

                SessionTime = HttpContext.Current.Session.Timeout.ToString();


                MEMORY_INFO MemInfo;
                MemInfo = new MEMORY_INFO();
                GlobalMemoryStatus(ref MemInfo);
                MemoryLoad = MemInfo.dwMemoryLoad + " %";
                TotalPhys = dFileSize(MemInfo.dwTotalPhys);
                AvailPhys = dFileSize(MemInfo.dwAvailPhys);
                TotalPageFile = dFileSize(MemInfo.dwTotalPageFile);
                AvailPageFile = dFileSize(MemInfo.dwAvailPageFile);
                TotalVirtual = dFileSize(MemInfo.dwTotalVirtual);

            }

  • 相关阅读:
    UVa 122 Trees on the level
    UVa 623 500!
    UVa 424 Integer Inquiry
    UVa 10082 WERTYU
    关于c语言的输入输出
    (转)提问的智慧for oracle
    根据输入的用户ID串,返回用户名字串:TRIM函数的使用
    转:Oracle数据库一致性读的原理(Consistent Read)
    Instr()函数的使用计算字符串中出现某个字母或单词的个数
    RETURNING的使用:
  • 原文地址:https://www.cnblogs.com/chengeng/p/3287009.html
Copyright © 2011-2022 走看看