programming4us
programming4us
DESKTOP

Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 11) - Monitoring performance from the command line

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Monitoring performance from the command line

Windows Server 2012 includes a command-line utility called Typeperf for writing performance data to the command line. You can use it to monitor the performance of both local and remote computers. The available parameters for Typeperf are summarized in Table 2.

Table 2. Parameters for Typeperf

Parameter

Description

–cf <filename>

Specifies a file containing a list of performance counters to monitor.

–config <filename>

Specifies the settings file containing command options.

–f <CSV|TSV|BIN|SQL>

Sets the output file format. The default is .csv for comma-separated values.

–o <filename>

Sets the path of an output file or SQL database.

–q [object]

Lists installed counters for the specified object.

–qx [object]

Lists installed counters with instances.

–s <ComputerName>

Sets the server to monitor if no server is specified in the counter path.

–sc <samples>

Sets the number of samples to collect.

–si <[[hh:]mm:]ss>

Sets the time between samples. The default is 1 second.

–y

Answers Yes to all questions without prompting.

It looks complicated, I know, but Typeperf is fairly easy to use after you get started. In fact, all you really need to provide to get basic monitoring information is the path to the performance counter you want to track. The performance counter path has the following syntax:

\\ComputerName\ObjectName\ObjectCounter

Here, the path starts with the UNC computer name or IP address of the local or remote computer you are working with and includes the object name and the object counter to use. If you want to track System\Processor Queue Length on CORPSVR02, you type

typeperf "\\corpsvr02\System\Processor Queue Length"

Note

You might have noticed that I enclosed the counter path in double quotation marks. Although this is good form for all counter paths, it is required in this example because the counter path includes spaces.

You can also easily track all counters for an object by using an asterisk (*) as the counter name, such as in the following:

typeperf "\\corpsvr02\Memory\*"

Here, you track all counters for the Memory object.

A slight problem is introduced for objects that have multiple instances. For these objects, such as the Processor object, you must specify the object instance you want to work with. The syntax for this is as follows:

\\ComputerName\ObjectName(ObjectInstance)\ObjectCounter

Here, you follow the object name with the object instance in parentheses. To work with all instances of an object that has multiple instances, you use _Total as the instance name. To work with a specific instance of an object, use its instance identifier. For example, if you want to examine the Processor\%Processor Time counter, you must use either the following to work with all processor instances:

typeperf "\\corpsvr02\Processor(_Total)\%Processor Time"

or the code shown next to work with a specific processor instance:

typeperf "\\corpsvr02\Processor(0)\%Processor Time"

In this case, that is the first processor on the system.

By default, Typeperf writes its output to the command line in a comma-delimited list. You can redirect the output to a file using the –o parameter and set the output format using the –f parameter. The output format indicators are CSV for a comma-delimited text file, TSV for a tab-delimited text file, BIN for a binary file, and SQL for a SQL binary file. Consider the following example:

typeperf "\\corpsvr02\Memory\*" -o perf.bin -f bin

Here, you track all counters for the Memory object and write the output to a binary file called Perf.bin in the current directory.

If you need help determining the available counters, type typeperf –q followed by the object name for which you want to view counters, such as in the following:

typeperf -q Memory

If an object has multiple instances, you can list the installed counters with instances by using the –qx parameter, such as in the following:

typeperf -qx PhysicalDisk

You can use this counter information as input to Typeperf as well. Add the –o parameter, and write the output to a text file, such as in the following:

typeperf -qx PhysicalDisk -o perf.txt

Then, edit the text file so that only the counters you want to track are included. You can then use the file to determine which performance counters are tracked by specifying the –cf parameter followed by the file path to this counter file. Consider the following example:

typeperf -cf perf.txt -o c:\perflogs\perf.bin -f bin

Here, Typeperf reads the list of counters to track from Perf.txt and then writes the performance data in binary format to a file in the C:\PerfLogs directory.

The one problem with Typeperf is that it will sample data once every second until you tell it to stop by pressing Ctrl+C. This is fine when you are working at the command line and monitoring the output. It doesn’t work so well, however, if you have other things to do—and most administrators do. To control the sampling interval and set how long to sample, you can use the –si and –sc parameters, respectively. For example, if you want Typeperf to sample every 60 seconds and stop logging after 120 samples, you could type this:

typeperf -cf perf.txt -o C:\perf\logs\perf.bin -f bin -si 60 -sc 120
INSIDE OUT: Use Windows PowerShell for performance monitoring

Windows PowerShell includes several cmdlets for performance monitoring. The one you’ll use the most is Get-Counter. You use Get-Counter to get objects representing real-time performance counter data. The paths you work with when specifying counters are similar to those used with Typeperf. For example, you track all counters for the Memory object on CorpSvr35 by entering the following command:

get-counter "\\corpsvr35\Memory\*"

If you want to examine the Processor\%Processor Time counter, you either work with all processor instances:

get-counter "\\corpsvr35\Processor(_Total)\%Processor Time"

or with a specific processor instance:

get-counter "\\corpsvr35\Processor(0)\%Processor Time"

Need to know which counters are available for an object? Simply type get-counter -listset followed by the object name, such as:

get-counter -listset Memory

Here, you list all the counters for the Memory object.

Analyzing trace logs at the command line

You can examine trace log data by using the Tracerpt command-line utility. Tracerpt processes trace logs, and you can use it to generate trace analysis reports and dump files for the events generated. Commonly used parameters for Tracerpt are summarized in Table 3.

Table 3. Parameters for Tracerpt

Parameter

Description

–o [filename]

Sets the text output file to which the parsed data should be written. The default is Dumpfile.xml.

–summary [filename]

Sets the name of the text file to which a summary report of the data should be written. The default is Summary.txt.

–report [filename]

Sets the name of the text file to which a detailed report of the data should be written. The default is Workload.xml.

–rt <session_name [session_name …]>

Sets the real-time event trace session data source to use instead of a converted log file.

–config <filename>

Specifies a settings file containing command options.

–y

Answers Yes to all questions without prompting.

-of <CSV|EVTX|XML>

Sets the dump file format.

-f <XML|HTML>

Sets the report file format.

–export <filename>

Sets the name of the event schema export file. The default is schema.man.

The most basic way to use Tracerpt is to specify the name of the trace log to use. By default, trace logs are written to C:\PerfLogs. So, if a log in this directory was named SysP_000002.etl, you could analyze it by typing the following:

tracerpt C:\Perflogs\SysP_000002.etl

Here, four files are created in the current directory. The parsed output is written to Dumpfile.xml, a summary report is written to Summary.txt, a detailed report is written to Workload.xml, and an event schema report file is written to schema.man.

You could also specify the exact files to use for output as shown in the following example:

tracerpt C:\Perflogs\ SysP_000002.etl -o c:\sysp.csv
-summary c:\sysp-summary.txt -report sysp-report-.txt
Other  
 
Top 10
Free Mobile And Desktop Apps For Accessing Restricted Websites
MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
TOYOTA CAMRY 2; 2.5 : Camry now more comely
KIA SORENTO 2.2CRDi : Fuel-sipping slugger
How To Setup, Password Protect & Encrypt Wireless Internet Connection
Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
Backup & Restore Game Progress From Any Game With SaveGameProgress
Generate A Facebook Timeline Cover Using A Free App
New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
- Messages forwarded by Outlook rule go nowhere
- Create and Deploy Windows 7 Image
- How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
- Creating and using an unencrypted cookie in ASP.NET
- Directories
- Poor Performance on Sharepoint 2010 Server
- SBS 2008 ~ The e-mail alias already exists...
- Public to Private IP - DNS Changes
- Send Email from Winform application
- How to create a .mdb file from ms sql server database.......
programming4us programming4us
programming4us
 
 
programming4us