Valhalla Legends Archive

Programming => General Programming => Topic started by: Mephisto on May 24, 2004, 10:31 PM

Title: Active System Information Updates
Post by: Mephisto on May 24, 2004, 10:31 PM
Recently I've been working on a program which actively updates your system's current information on Windows NT 4.0+.  I'm wondering though if anyone has used a program like this.  Typically a window that has a list of system informations like CPU usage, memory allocated, memory avaliable, page file, etc. etc. -- does anyone know of any free ones?  I'd like to get some ideas from them.  If one came with the source that'd be even better.  Thanks...

Just an example of what you might see in the window:

CPU Usage: 55%
Memory Avaliable: 403MB
Memory Used: 7021MB
Drive C Space: 4GB
IP: 63.241.83.7
etc.
Title: Re:Active System Information Updates
Post by: Grok on May 24, 2004, 10:52 PM
I might should not tell you this, but you have taken the first step to becoming a decent programmer.  What has at some point driven many good programmers is an innate (maybe insane?), obsession with learning and understanding all the low-level mechanisms associated with their computer and operating systems.

When evaluating people on their computer I.Q., I often ask them distributed and varied, but surgical, questions about their systems.  Like, "describe to me the partition tables and how they are used in the PC boot sequence."
Title: Re:Active System Information Updates
Post by: Mephisto on May 24, 2004, 10:58 PM
:)  I remember how excited I was when I first disected a computer, and how insanely excited I was to see it boot up while looking inside, though I was disapointed because I thought I was going to see eletricity, heh.  But that was some time ago.  ;)
Title: Re:Active System Information Updates
Post by: effect on May 24, 2004, 11:30 PM
Why ask for something when u know its all on pscode?, (I guarentee there are more 100 examples of what your asking for)
Title: Re:Active System Information Updates
Post by: Mephisto on May 24, 2004, 11:43 PM
Quote from: effect on May 24, 2004, 11:30 PM
Why ask for something when u know its all on pscode?, (I guarentee there are more 100 examples of what your asking for)

Not very accurate to assume someone would know where those places are, because I for one don't.  Thanks, though...
Title: Re:Active System Information Updates
Post by: effect on May 24, 2004, 11:47 PM
Uve been here for 200 odd post's now , i assume people with any programming experience (who are serious) and who have been here for that amount of time  know about the existance of pscode.
Title: Re:Active System Information Updates
Post by: Mephisto on May 24, 2004, 11:51 PM
Looking at the Website I see it's relatively shit and pointless...I don't see why you would think everyone who is *serious* about programming would know about it...The server is also extremely slow...
Title: Re:Active System Information Updates
Post by: effect on May 25, 2004, 12:19 AM
Quote from: Mephisto on May 24, 2004, 11:51 PM
Looking at the Website I see it's relatively shit and pointless...I don't see why you would think everyone who is *serious* about programming would know about it...The server is also extremely slow...


Oh yea , your just ignoring the million lines of source code that resides there?
Title: Re:Active System Information Updates
Post by: Fr0z3N on May 25, 2004, 12:21 AM
Rules before posting:

1. Google
2. PSCode
3. Forum Search

Posting is usually my last resort because everything has been asked you just have to find the answer.
Title: Re:Active System Information Updates
Post by: Eibro on May 25, 2004, 12:47 AM
taskmgr.exe displays most of that.
Title: Re:Active System Information Updates
Post by: Maddox on May 25, 2004, 01:04 AM
GetSystemInfo() and GlobalMemoryStatus() is what I looked up from DMBot.

As for getting the WAN IP, I know of no standard way of getting it without some sort of remote server.
Title: Re:Active System Information Updates
Post by: Grok on May 25, 2004, 01:33 AM
Quote from: effect on May 25, 2004, 12:19 AM
Quote from: Mephisto on May 24, 2004, 11:51 PM
Looking at the Website I see it's relatively shit and pointless...I don't see why you would think everyone who is *serious* about programming would know about it...The server is also extremely slow...


Oh yea , your just ignoring the million lines of source code that resides there?

You're in desperate need to read "Second Foundation" by Isaac Asimov.
Title: Re:Active System Information Updates
Post by: effect on May 25, 2004, 03:53 AM
Quote from: Grok on May 25, 2004, 01:33 AM
Quote from: effect on May 25, 2004, 12:19 AM
Quote from: Mephisto on May 24, 2004, 11:51 PM
Looking at the Website I see it's relatively shit and pointless...I don't see why you would think everyone who is *serious* about programming would know about it...The server is also extremely slow...


Oh yea , your just ignoring the million lines of source code that resides there?

You're in desperate need to read "Second Foundation" by Isaac Asimov.

"thall shall not smigten thy heathen but let him into thy house"

wildstab at what your getting at  :P
Title: Re:Active System Information Updates
Post by: Tuberload on May 25, 2004, 04:04 AM
Since we are recommending books for people to read, Mephisto:

A Lesson in Personal Empowerment
by John J. Murphy
Title: Re:Active System Information Updates
Post by: Eli_1 on May 25, 2004, 05:42 AM
I'm glad to see the regular forum flamers were able to stop by and waste everyone's time -- again.
Title: Re:Active System Information Updates
Post by: Tuberload on May 25, 2004, 06:14 AM
Quote from: Eli_1 on May 25, 2004, 05:42 AM
I'm glad to see the regular forum flamers were able to stop by and waste everyone's time -- again.

A good 70% of the posts on this forum could be concidered a waste of time, so please don't pass out all the credit to the participants of this thread. Besides I don't see how anyone here is a regular flamer...
Title: Re:Active System Information Updates
Post by: Mephisto on May 25, 2004, 09:04 AM
*shrug*
Title: Re:Active System Information Updates
Post by: effect on May 25, 2004, 10:32 AM
Quote from: Mephisto on May 25, 2004, 09:04 AM
*shrug*

You obviously didnt take his advice. (heathen)
Title: Re:Active System Information Updates
Post by: Noodlez on May 25, 2004, 11:51 AM
Download SiSoft Sandra, it is free software that displays nearly everything about your computer.
Title: Re:Active System Information Updates
Post by: Mephisto on May 25, 2004, 02:02 PM
Quote from: Noodlez on May 25, 2004, 11:51 AM
Download SiSoft Sandra, it is free software that displays nearly everything about your computer.

Can you provide a link?  Their Website is hell to navigate through for me...
Title: Re:Active System Information Updates
Post by: Eli_1 on May 25, 2004, 02:03 PM
Quote from: Tuberload on May 25, 2004, 06:14 AM
A good 70% of the posts on this forum could be concidered a waste of time, so please don't pass out all the credit to the participants of this thread. Besides I don't see how anyone here is a regular flamer...

Yea, I'm sorry about that. It was really early and I didn't read some of the responses clearly -- I could have sworn I saw someone tell Mephisto to "get a life."
Title: Re:Active System Information Updates
Post by: Tuberload on May 25, 2004, 04:48 PM
Quote from: Eli_1 on May 25, 2004, 02:03 PM
Quote from: Tuberload on May 25, 2004, 06:14 AM
A good 70% of the posts on this forum could be concidered a waste of time, so please don't pass out all the credit to the participants of this thread. Besides I don't see how anyone here is a regular flamer...

Yea, I'm sorry about that. It was really early and I didn't read some of the responses clearly -- I could have sworn I saw someone tell Mephisto to "get a life."


Please don't apologize to me, I am sorry as well. I was more defending myself as to being a regular flamer. I wasn't really attempting to flame, just sticking up for a friend the same way other people were.
Title: Re:Active System Information Updates
Post by: Tuberload on May 25, 2004, 04:49 PM
Quote from: Mephisto on May 25, 2004, 09:04 AM
*shrug*

I didn't really expect you to understand the reasoning or the meaning of my post, so I guess I will just *shrug* as well.
Title: Re:Active System Information Updates
Post by: Mephisto on May 25, 2004, 06:00 PM
Quote from: Tuberload on May 25, 2004, 04:49 PM
Quote from: Mephisto on May 25, 2004, 09:04 AM
*shrug*

I didn't really expect you to understand the reasoning or the meaning of my post, so I guess I will just *shrug* as well.

It was actually pretty obvious...You couldn't have made it much clearer...I just didn't agree...Unless of course I'm way off and mis-interpreted the whole thing...
Title: Re:Active System Information Updates
Post by: Tuberload on May 25, 2004, 06:17 PM
Quote from: Mephisto on May 25, 2004, 06:00 PM
Quote from: Tuberload on May 25, 2004, 04:49 PM
Quote from: Mephisto on May 25, 2004, 09:04 AM
*shrug*

I didn't really expect you to understand the reasoning or the meaning of my post, so I guess I will just *shrug* as well.

It was actually pretty obvious...You couldn't have made it much clearer...I just didn't agree...Unless of course I'm way off and mis-interpreted the whole thing...

I am going to continue this on IM.
Title: Re:Active System Information Updates
Post by: Noodlez on May 27, 2004, 11:57 AM
Quote from: Mephisto on May 25, 2004, 02:02 PM
Quote from: Noodlez on May 25, 2004, 11:51 AM
Download SiSoft Sandra, it is free software that displays nearly everything about your computer.

Can you provide a link?  Their Website is hell to navigate through for me...

http://download.guru3d.com/sandra/
Title: Re:Active System Information Updates
Post by: warz on May 27, 2004, 12:54 PM
Quote from: Mephisto on May 24, 2004, 10:31 PM
Recently I've been working on a program which actively updates your system's current information on Windows NT 4.0+.  I'm wondering though if anyone has used a program like this.  Typically a window that has a list of system informations like CPU usage, memory allocated, memory avaliable, page file, etc. etc. -- does anyone know of any free ones?  I'd like to get some ideas from them.  If one came with the source that'd be even better.  Thanks...

Just an example of what you might see in the window:

CPU Usage: 55%
Memory Avaliable: 403MB
Memory Used: 7021MB
Drive C Space: 4GB
IP: 63.241.83.7
etc.

The best one ever: gkrellm
Search for it, it's intense.
Title: Re:Active System Information Updates
Post by: K on May 30, 2004, 06:32 PM
Here's a quick example of what you can do using the System.Management assembly in .NET.


using System;
using System.Management;

namespace Monitor
{

   class ExampleClass
   {
      [STAThread]
      static void Main(string[] args)
      {
         PerformanceWatcher p = new PerformanceWatcher();
         p.UpdateAll();

         Console.WriteLine("CPU Usage: {0}%", p.GetCPUUsagePercent());
         Console.WriteLine("Free Memory: {0} MB -or- {1} KB -or- {2} Bytes", p.GetFreeMemMBytes(), p.GetFreeMemKBytes(), p.GetFreeMemBytes());
      }
   }

   class PerformanceWatcher
   {
      protected ManagementScope _msScope = new ManagementScope(ManagementPath.DefaultPath);
      protected ManagementObjectSearcher _mosSearch = new ManagementObjectSearcher();
      protected ManagementObjectCollection _mocCollection;
      protected ObjectQuery _oqCPUQuery = new ObjectQuery("SELECT PercentProcessorTime, TimeStamp_Sys100NS FROM Win32_PerfRawData_PerfOS_Processor where Name='_Total'");
      protected ObjectQuery _oqMemQuery = new ObjectQuery("SELECT AvailableMBytes, AvailableKBytes, AvailableBytes FROM Win32_PerfRawData_PerfOS_Memory");

      protected ulong _ulFreeMemMB = 0;
      protected ulong _ulFreeMemKB = 0;
      protected ulong _ulFreeMemB  = 0;
      protected double _dbCpuUsagePercent = 0;

      public PerformanceWatcher()
      {
         _msScope.Connect();
         _mosSearch.Scope = _msScope;
      }

      public void UpdateAll(int cpu_timing_ms)
      {
         UpdateFreeMem();
         UpdateCPUUsage(cpu_timing_ms);
      }
      public void UpdateAll()
      {
         UpdateFreeMem();
         UpdateCPUUsage();
      }

      public void UpdateCPUUsage()
      {
         UpdateCPUUsage(2000);
      }
      public void UpdateCPUUsage(int timing_ms)
      {
         _mosSearch.Query = _oqCPUQuery;
         _mocCollection = _mosSearch.Get();

         double n1 = 0, d1 = 0, n2 = 0, d2 = 0;
         foreach(ManagementObject m in _mocCollection)
         {
            n1 = (ulong)m["PercentProcessorTime"];
            d1 = (ulong)m["TimeStamp_Sys100NS"];
           break;
         }

         System.Threading.Thread.Sleep(timing_ms);

         _mocCollection = _mosSearch.Get();
         foreach(ManagementObject m in _mocCollection)
         {
            n2 = (ulong)m["PercentProcessorTime"];
            d2 = (ulong)m["TimeStamp_Sys100NS"];
           break;
         }

         _dbCpuUsagePercent = Math.Abs(Math.Round((1 - ((n2 - n1)/(d2 - d1)))*100, 2));
      }

      public void UpdateFreeMem()
      {
         _mosSearch.Query = _oqMemQuery;
         _mocCollection = _mosSearch.Get();

         foreach(ManagementObject m in _mocCollection)
         {
            _ulFreeMemMB = (ulong)m["AvailableMBytes"];
            _ulFreeMemKB = (ulong)m["AvailableKBytes"];
            _ulFreeMemB  = (ulong)m["AvailableBytes"];
           break;
         }
      }


      public double GetCPUUsagePercent()
      {
         return _dbCpuUsagePercent;
      }

      public ulong GetFreeMemMBytes()
      {
         return _ulFreeMemMB;
      }

      public ulong GetFreeMemKBytes()
      {
         return _ulFreeMemKB;
      }

      public ulong GetFreeMemBytes()
      {
         return _ulFreeMemB;
      }
   };
}
Title: Re:Active System Information Updates
Post by: vile on May 31, 2004, 03:01 AM
Don't worry, that's way beyond Mephisto (jk).