Monitoring system resources with TYPEPERF

Source: Internet
Author: User

Yesterday in a program for memory overflow detection, the program needs to monitor the memory for a long time, after the end, through the Excel chart to see if the memory is growing trend. For this piece of monitoring, a lot of people commonly used by the use of Windows performance monitoring tools, hehe, is quite simple, but I still prefer the command line of the way, which I usually like to engage in automation is a bit of a relationship.

Today we will introduce you to the typeperf command, as well as the simple common techniques.

about typeperf not detailed, you think of it as a performance monitoring tool (Windows comes with) The command line version of the line, Microsoft provides a command line under the Monitoring tool, collect performance counter performance data. typeperf -? Can be used to view specific help for this command.

prior to monitoring the need to determine what we want to monitor the content, is to monitor memory,CPU, disk, network and so on? Each performance counter will have its own name, and the first step is to determine the name of the performance counter for which we want to monitor the content.

There are two ways to do this:

  method One : Through Performance Monitor, add the performance counters we need, some counters need to select the corresponding instance, that is, you need to monitor which process performance, choose to add the counter, click the OK button.

The data statistics trend for the selected performance counter is displayed in the Performance Monitor main window, right-clicking the main window, and selecting the "Properties" menu from the pop-up menu.

The specific name of the performance counter can be clearly seen in the Data tab of the Monitor's Properties dialog box. Copy it to a text file once, and don't know if it can be copied, try it.

method Two : The second method is also one of my recommended methods, under the command line using typeperf -qxok< Span lang= "ZH-CN" >, also on that several commonly used, process, disk, network, memory and other processes later I will tidy up. The process performance counters begin with processmemory -qx export all performance counters via typeperf-QX > All_counters.txt

Can I use typeperf -qx to filter during execution? The answer is yes. See below, the QX parameter has an option followed by an object, followed by the specific counter name. This name needs to be remembered by itself.

Typeperf- Q and typeperf-qx of the difference between their own targeted execution once again to see it, I believe you will understand.

  Here's An example , for example, I want to monitor the CPUand memory of an OUTLOOK process:

1, this time we are monitoring a specific process, is a specific instance, then definitely use typeperf -qx, Process counter name for the processes , so execute the command TYPEPERF-QX Process

2, after the execution, I believe you will see a lot of content, examples are in the process behind parentheses in the difference between the embodiment, through the Task Manager to determine the specific process of our Outlook , to review the process for Outlook. EXE, uppercase,typeperf in case sensitive, this needs to be noted, then the name of the instance is Outlook, corresponding to the Process (Outlook), How do I filter out counters with OUTLOOK strings in just the results ? Using the FIND command to mate a pipeline,typeperf-qx Process | Find "Outlook", after the execution you will find about the OUTLOOK of This process related performance counters are listed, and not many, manual copy can be, hehe.

3. Next, you can continue filtering through the FIND command, such as filtering TYPEPERF-QX Process | FIND "OUTLOOK" | FIND "Processor"

After filtering only one, is exactly what we need the CPU counter. Outputs the returned results to the counters.txt file by redirection .

4, continue to filter memory-related

Continue to append using redirects, you need to be aware that the Append redirect is used here

Check out our counters.txt file contents after appending

5, next use the typeperf command to monitor these performance counters, using the command

Typeperf-f csv-o mycounters.csv-si 15-cf counters. TXT-SC

Parameter description can refer to typeperf -?

-F: Indicates the output file type

-O: Indicates the output file name

-si: Indicates the performance counter data acquisition cycle (capture once per number of seconds, note format)

-CF: The configuration file that represents the performance counter (that's what we did before Counters.txt)

-SC: Indicates how many times you need to collect

The above command indicates that it is collected every second, in total, for a total of up to 15* =15*60*4 = 3,600 = 1 hours, which indicates to the OUTLOOK process CPU and memory for 1 hours of monitoring.

6, after the execution, in the C:\Users\Administrator directory will be generated mycounters.csv file, open after the same as Excel , select a column, Insert a statistical chart that can be very intuitive to see the trend of a performance counter within an hour

The end of this share

Finally, there are some questions, such as what to monitor and what to do with performance analysis, and you can think about it in a divergent way. Monitoring is just a means to facilitate our next analysis.

Use Typeperf to monitor system resources

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.