Chapter Contents |
Previous |
Next |
SAS Companion for the Microsoft Windows Environment |
Version 8 of the SAS System for Windows includes the following application-defined counters in the SAS object:
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.
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 |
You set up all examples as follows:
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
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.
To perform a PROC SQL with an index:
To perform a 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
Performance of PROC SQL without an Index
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.