49

Is there someway to record Task Managers info about CPU and memory usage to examine later? Or an equivalent tool?

rkthkr
  • 8,728

9 Answers9

34

Windows Performance Monitor (perfmon) should do the job for you; you can configure it to log to a file, so just enable the counters you need and it'll log as much as you want.

RainyRat
  • 3,750
20
  • Start > Run > perfmon
  • Hit the plus sign next to Performance Logs and Alerts
  • Right click System Log and select properties.
  • Adjust the sampling times to whatever you like
  • When you are done, hit OK then the plus sign at the top of the window.

This page gives a pretty good step-by-step with screenshots

matt
  • 1,162
4

You may consider using a monitoring solution like zabbix, zenoss to collect and analyse your perf counters.

Maxwell
  • 5,086
4

Process Explorer will also show CPU history.

MathewC
  • 7,147
4

I use PolyMon to monitor these kinds of things. You can define various "alert" conditions about which you'd like to receive notification, so I get notified if one of my servers is having a problem.

But it also stores all these results in a long term database, so I can look back at the memory usage of server "X" and see it's memory usage trends over the last N days/weeks/months/years.

http://polymon.codeplex.com/

Bob
  • 587
3

Opensource solution Nagios does this also:

3

Cacti is a great webv based graphing programme. It can graph CPU, memory, disk space, etc, etc. It can also be extended with your own plugins.

Amandasaurus
  • 33,461
1

Yes, perfmon ("Performance Monitor" in Control Panel)

0

Simple PowerShell script for the job:

# Define the output file
$outputFile = "C:\tmp\cpu_usage_log.csv"

Check if file exists, if not create with headers

if (!(Test-Path $outputFile)) { "Timestamp,CPU_Usage,Memory_Usage" | Out-File $outputFile }

while ($true) { # Capture current timestamp, CPU usage, and memory usage $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" $cpuUsage = [math]::Round((Get-Counter '\Processor(_Total)% Processor Time').CounterSamples.CookedValue, 2) $memoryUsage = [math]::Round((Get-Counter '\Memory\Committed Bytes').CounterSamples.CookedValue / 1MB)

# Format the output
$logEntry = "$timestamp,$cpuUsage,$memoryUsage"

# Append the log entry to the file
$logEntry | Out-File -FilePath $outputFile -Append

# Pause for a specified interval (e.g., 5 seconds)
Start-Sleep -Seconds 5

}

Then save in a file (eg. log_cpu_and_memory.ps1) and run in elevated PowerShell (Win + R -> powershell.exe -> Ctrl + Shift + Enter)

./log_cpu_and_memory.ps1

The output is a CSV file with the following format:

Timestamp,CPU_Usage,Memory_Usage
2024-09-23 13:25:48,0.85,14520
2024-09-23 13:25:55,1.44,14464
2024-09-23 13:26:02,4.9,14599

What I like about this solution is that it creates a live log that can be interrupted by the system, eg. due to shutdown, low battery, etc. There is no need to save the recorded log manually.

Voy
  • 221
  • 2
  • 3