Skip to main content

How to Record CPU and Memory Usage Over Time in Windows?

Whenever the computer is lagging or some application is taking too long to respond, we usually fire up task manager and look under the Performance tab or under Processes to check on processor utilization or the amount of free memory available. The task manager is ideal for real-time analysis of CPU and memory utilization. It even displays a short history of CPU utilization in the form of a graph. You get a small time-window, about 30 seconds or so, depending on how large the viewing area is.

task-manager

However, 30 seconds is rather short to make any meaningful analysis of the performance of a process or the system as a whole. Some users lament that there is no data logging feature in Task Manager to plot CPU usage over a longer time duration. Truth is, the task manager isn’t meant to be used as a performance analysis tool. For this purpose there is another more powerful tool called Performance Monitor. It is a part of Windows and it has the ability to record CPU and memory utilization and a host of other parameters for a long period of time.

To launch Performance Monitor, press Win+R on your keyboard and in the Run dialog box type perfmon and press Enter.

To get an immediate and real-time view of CPU utilization, click on Performance Monitor on the left-hand Console Tree. The color scheme of the graph is different (red over white), but it is the same graph you can see under Task Manager.

To enable logging you have to create a new Data Collector Set. On the navigation panel on the left, expand Data Collector Set and right click on User Defined. From the New menu click Data Collector Set.

perfmon1

Give a name to the set that you can recognize later, and choose the radio button Create manually. Click Next.

perfmon2 (3)

Under type of data, choose Create Data Log and check the box Performance counter. Click Next.

perfmon2 (4)

Here I want to add a quick note on the different types of data log available and what each of them does.

  • Performance counters are measurements of system state or activity. This option polls the requested parameters at specified time intervals and records the data returned.
  • Event trace data only logs the event when something happens. The data is collected from trace providers, which are components of the operating system or of individual applications that report actions or events.
  • Configuration information is collected from key values in the Windows registry. Windows Performance Monitor can record the value of a registry key at a specified time or interval.

Now is the time to choose the performance counters which you would like to log. Click on the Add button and choose one of the many available counters. You can log processor utilization, processor idle time or interrupt time, memory usage, USB activity and dozens of other counters. In this example, we chose Processor Time.

perfmon2 (6)

Adjust the poll interval. 5 seconds should do.

perfmon2 (1)

At this step, you can either click the Finish button or progress though the next few steps where you can specify the location of the log file or configure the Data Collector Set to run as a specific user.

Once the data set is created, run it. The Data Collector Set will start recording data from the chosen performance monitor, in our case, CPU utilization. Reports aren’t available when the data set is running. After you stop it, you can see your report under the Reports directory in the navigation panel.

perfmon12

Here is our CPU utilization graph recorded over a period of 3 minutes.

perfmon14

Aside from CPU utilization you can record memory usage, disk activity, network activity, system events, and several other things.

Comments

  1. This is absolutely fantastic. I've been looking all over for a resource monitoring tool and this works just great. Thanks

    ReplyDelete
  2. I'm usually troubleshooting linux boxes and was looking for something like sar. Having this right out the box in Win7 is great. Thanks for the article, helped loads!

    ReplyDelete
  3. how to monitor multiple instances of IE 8 in Perfmon? IE 8 creates a new process every time a tab is created. will the new process will be automatically monitored?

    ReplyDelete
  4. I'm not sure about IE8's multiple processes monitoring. Why don't you try it out and report your findings here?

    ReplyDelete
  5. But I don't think processor time tells the CPU usage as I'm doing performance test. I googled it and somebody said there is a calculation between processor time and CPU usage.

    ReplyDelete
  6. Hi, How to view CPU Usage for a particular application instance or object

    ReplyDelete
  7. Great. I finally found this useful article.

    ReplyDelete
  8. Thanks, Nice and straight to point tutorial.

    ReplyDelete
  9. Just wanted to second what everyone else is saying that this is a fantastic tutorial that exactly explained what I was looking for.

    ReplyDelete
  10. this is nice for cpu usage analysis on Windows 7 without other external tools.

    ReplyDelete
  11. You mentioned that we can see reports only when the collection is stopped? It means every time we have to stop it to see reports? This somehow does not sound user friendly.

    ReplyDelete
  12. Even though I've specified over all duration as 53 weeks, the data collection seems to be stopping at random; not able to trace why it had stopped. appreciate any support in this regard.

    ReplyDelete
  13. I'm using it right now

    ReplyDelete
  14. Thanks for this info, I have been using Linux for quite long time and use top cmd output to log the CPU, mem, swap, app usage, hdd I/o usage. But wonder how to log the data on windows to collect this info.

    ReplyDelete
  15. How we can use this to track the CPU performance for last 6 months ?

    Currently its only capturing the current CPU utilization

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Schedule Changes to Your Facebook Page Cover Photo

Facebook’s current layout, the so called Timeline, features a prominent, large cover photo that some people are using in a lot of different creative ways. Timeline is also available for Facebook Pages that people can use to promote their website or business or event. Although you can change the cover photo as often as you like, it’s meant to be static – something which you design and leave it for at least a few weeks or months like a redesigned website. However, there are times when you may want to change the cover photo frequently and periodically to match event dates or some special promotion that you are running or plan to run. So, here is how you can do that.

Diagram 101: Different Types of Diagrams and When To Use Them

Diagrams are a great way to visualize information and convey meaning. The problem is that there’s too many different types of diagrams, so it can be hard to know which ones you should use in any given situation. To help you out, we’ve created this diagram that lays out the 7 most common types of diagrams and when they’re best used: