Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

CPU Monitor in Notepad


  • Please log in to reply
6 replies to this topic

#1 VoidX789

VoidX789

  • Members
  • 82 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:38 PM

Posted 29 December 2010 - 06:06 PM

Anyone have any idea how to write a program in notepad that will monitor how much CPU space each process is using and write those values to a .log file every 30 minutes? Also, would it be possible to make this program run as a background process?

If this has to be split up into several programs, that is ok.
Welcome to the Void of Insanity
Posted Image

BC AdBot (Login to Remove)

 


#2 JosiahK

JosiahK

  • Members
  • 269 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:38 PM

Posted 30 December 2010 - 06:58 PM

Have you had a look at the tasklist command? It doesn't do exactly what you're after but it might be useful, note the /v switch to include more information.

I presume that by "program in notepad" you mean some sort of batch script, vbs script, js script, etc.
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.

#3 Didier Stevens

Didier Stevens

  • BC Advisor
  • 2,638 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:07:38 PM

Posted 01 January 2011 - 08:52 AM

Any particular reason you want to write a program to do this? IIRC, you can do this with Windows' Performance Monitor.

Didier Stevens
http://blog.DidierStevens.com
http://DidierStevensLabs.com

SANS ISC Handler
Microsoft MVP 2011-2016 Consumer Security, Windows Insider MVP 2016-2018
MVP_Horizontal_BlueOnly.png

 

If you send me messages, per Bleeping Computer's Forum policy, I will not engage in a conversation, but try to answer your question in the relevant forum post. If you don't want this, don't send me messages.

 

Stevens' law: "As an online security discussion grows longer, the probability of a reference to BadUSB approaches 1.0"


#4 VoidX789

VoidX789
  • Topic Starter

  • Members
  • 82 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:38 PM

Posted 18 January 2011 - 01:35 PM

@ josiahK
Im kind of an ameture when it comes to programming, so I have no clue what you mean by tasklist.
Do you mean this command? :http://technet.microsoft.com/en-us/library/bb491010.aspx
After looking at that page, I am twice as confused.
I am trying to write a batch file.

@ Didier Stevens
I do not want to download any more programs, and i figured this would be an interesting program to write. Also, I previously had a problem where the cpu went to 100%, so I figure that it would be a good idea to monitor the cpu usage.
Welcome to the Void of Insanity
Posted Image

#5 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:38 AM

Posted 19 January 2011 - 11:28 AM

Click on 'Start'. In the text field, type in 'performance monitor'. That comes with Windows 7, Windows Server 2008 R2, and Windows Vista. XP has 'perfmon'.

#6 Didier Stevens

Didier Stevens

  • BC Advisor
  • 2,638 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:07:38 PM

Posted 20 January 2011 - 02:26 PM

@ Didier Stevens
I do not want to download any more programs


Like groovicus wrote, performance monitoring is part of Windows, you don't have to download it.

Even if you want to program your own, I suggest you take a look at the build-in performance monitoring to get an idea of what's possible.

Didier Stevens
http://blog.DidierStevens.com
http://DidierStevensLabs.com

SANS ISC Handler
Microsoft MVP 2011-2016 Consumer Security, Windows Insider MVP 2016-2018
MVP_Horizontal_BlueOnly.png

 

If you send me messages, per Bleeping Computer's Forum policy, I will not engage in a conversation, but try to answer your question in the relevant forum post. If you don't want this, don't send me messages.

 

Stevens' law: "As an online security discussion grows longer, the probability of a reference to BadUSB approaches 1.0"


#7 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,250 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:10:38 AM

Posted 22 January 2011 - 08:04 PM

Using the built-in perfmon in combination with the also built-in logman (log manager) you can do a lot of system monitoring and logging for you. A simple example in a batch file:

logman create counter perf_log -c "\Processor(_Total)\% Processor Time" "\Memory\Available bytes"
logman start perf_log

Creates a new log called "perf_log" and starts logging total CPU use and total available system memory in it. When you're done logging and want to look at the data, issue this command:

logman stop perf_log

Logs are by default saved to C:\PerfLogs and can be viewed by double-clicking them.

There are hundreds of possible things to monitor using these tools. To get a list of counters available on your system, use this command:
typeperf -q


*Note: the above info is probably specific to Windows XP and 2003, Vista and Windows 7 might have different names for the tools or different tools entirely.

Edited by Andrew, 22 January 2011 - 08:08 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users