Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

NT Performance Monitor

Windows NT Performance Monitor (PERFMON.EXE) may be invoked from the Administrative Tools folder. Using Performance Monitor, you can monitor many of the Windows NT internal processes as well as information from third-party applications. Each piece of information monitored is known as a counter. Each counter can be found in logically grouped objects. For example, Windows NT has a Memory object that contains counters such as Available Bytes, Committed Bytes, and Page Faults/sec. The Processor object has counter such as %Processor Time and %User Time. By observing various system counters and application-defined counters, it is possible to determine performance problems. You can search for bottlenecks in your system and isolate them to areas such as hardware, system software, or your application. For more information on NT Performance Monitor, refer to the Windows NT Resource Kit.

Version 8 of the SAS System for Windows includes the following application-defined counters in the SAS object:

Virtual Alloc'ed Memory
specifies the amount of committed virtual memory allocated by SAS through the VirtualAlloc() API.

Disk ReadFile Bytes Read Total
specifies the total number of bytes read from disk files by SAS through the ReadFile() API.

Disk ReadFile Bytes Read/Sec
specifies the number of bytes read per second from disk files by SAS through the ReadFile() API.

Disk WriteFile Bytes Written Total
specifies the total number of bytes written to disk files by SAS through the WriteFile() API.

Disk WriteFile Bytes Written/Sec
specifies the number of bytes written per second to disk files by SAS through the WriteFile() API.

Disk SetFilePointer/Sec
specifies the number of times per second that the SetFilePointer() API has been successfully called by SAS on disk files.

PSE36 Current Usage K
specifies the amount of Extended Server Memory currently in use.

PSE36 Peak Usage K
specifies the maximum amount of Extended Server Memory used in the current SAS session.

To monitor SAS counters, start SAS and then start NT Performance Monitor by selecting Performance Monitor from the Administrative Tools folder. Then click on the Add Counter ([+]) button to open the Add to Chart dialog box. After selecting SAS from the Object combo box, the Add to Chart dialog box looks like Add to Chart Dialog Box.

Add to Chart Dialog Box

[IMAGE]

For a description of each counter, click on [Explain]. You can now select counters from the list box, clicking on [Add] after each selection. After selecting the counters you want to monitor, click on [Done]. Performance Monitor immediately collects and display information about the counters you selected.

You may see multiple instances monitored, where each instance is a separate SAS process. SAS instances are listed in the form "SAS PID number". The PID number is the process identifier of the SAS session. You can see a list of all processes using NT Task Manager.

Performance Monitor is useful for tuning and diagnosing your application or computer system. By correlating the information from the SAS counters with other NT counters, you can more easily troubleshoot performance problems. An example would be a case of a user whose SAS job appears not to be working. Perhaps it is performing a long and complicated data step that generates a very large data set on a network volume. The user can be certain that the job is still working by monitoring the Disk WriteFile Bytes Written/Sec and Disk WriteFile Bytes Written Total counters.


Examples of Monitoring SAS Performance

The examples in this section show how the system performs when SAS process the DATA, PROC SORT, and PROC SQL steps. By entering the example SAS code in these examples, you can see how SAS uses the various system resources.

You set up all examples as follows:

  1. invoke SAS and the Performance Monitor

  2. open the Add Chart window and select the SAS object

  3. add these SAS counters:

  4. select the Process object and select `sas' from the Instances list box

  5. add these Process counters:

  6. click on [Done].


Examining the Performance Between the DATA and PROC SORT Steps

To see the difference in performance between the DATA step and the PROC step, submit this code:

options fullstimer;
  /* Create a test data set with some random data. */
DATA a (drop=s);
   do i = 1 to 500000;
      x = ranuni(i);
      y = x*2;
      z = exp(x*y);
      output;
   end;
   /* The sleep helps to delineate the subsequent  */
   /* sort in the Performance Monitor graph        */
   s = sleep(15);
run;
PROC sort data = a noduplicates;
   by z y x i;
run;

After submitting this code, the Performance Monitor graph should generate results like those in Performance of the DATA Step and the PROC SORT Step. You may have to adjust the scale factor of the different counters.

Performance of the DATA Step and the PROC SORT Step

[IMAGE]

You can see in the DATA step that there is very little activity from Disk ReadFile Bytes Read/Sec or Disk SetFilePointer/Sec. Notice that in the subsequent PROC SORT there is much more activity from these two counters. This indicates that the data set is being read (Disk Readfile Bytes Read/Sec) in order to be sorted, and that a certain amount of random I/O is performed by the sort (Disk SetFilePointer/Sec). The pause in the activity is caused by the SLEEP function that comes after the DATA step. The Disk WriteFile Bytes Written/Sec is active in both the DATA step and the PROC SORT. Lastly, you can correlate the counters from the Process object with the user and system CPU times in your SAS log.

Examining a PROC SQL Query

In this example you'll be submitting code to examine the performance of a PROC SQL query with and without using an index. Be sure that SAS and Performance Monitor are started.

To perform a PROC SQL with an index:

  1. submit the code in Step 1 and Step 2. Step 2 creates an index.

  2. clear the Performance Monitor graph by selecting Clear Display from the Edit menu

  3. submit the code in Step 3 to see a graph like Performance of PROC SQL with an Index.

To perform a PROC SQL without an index:

  1. resubmit Step 1

  2. clear the Performance Monitor graph

  3. resubmit Step 3 to see a graph like Performance of PROC SQL without an Index.

   /* Step 1                                        */
   /* Create a test data set with some random data. */
   /* Do this twice - once with Step 2 and once     */
   /* without Step 2.                               */

libname sample 'c:\';
DATA sample.a;
   do i = 1 to 500000;
      x = ranuni(i);
      y = x*ranuni(i);
      z = exp(y);
      output;
   end;
run;

   /* Step 2                                        */
   /* Create a simple index on variable x.          */
   /* Submit this step once.                        */

PROC DATASETS library = sample;
   modify a;
   index create x;
   quit;

   /* Step 3                                        */
   /* Perform a query on the data.  Do this twice - */
   /* once with an index and once without an index  */
   /* The query should select about 50% of the      */
   /* observations in the data set.                 */

PROC SQL;
   create table sample.yz as
   select y,z
      from sample.a
      where x > 0.5;
   quit;

Performance of PROC SQL with an Index

[IMAGE]

Performance of PROC SQL without an Index

[IMAGE]

In Performance of PROC SQL without an Index, the counters averaged under 10% on the scale, whereas in Performance of PROC SQL with an Index, several of the counters averaged well over 10%, and the Disk WriteFile Bytes Written/Sec counter rose over 25%. A higher value for these counters implies good overall throughput for the operation. Note that to make a valid comparison like this with Performance Monitor graph, you must make sure that the counters are using the same scale. You can double-check by observing the absolute values. The Average value for Disk WriteFile Bytes Written/Sec in Performance of PROC SQL with an Index was 92528.953. Contrast this with the same counter in Performance of PROC SQL without an Index, in which the Average value was 47350.902. For this operation, bytes were written almost twice as fast when the data set was indexed.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.