Skip to content

Instantly share code, notes, and snippets.

@boomskats
Created November 22, 2017 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boomskats/34baa6ff267556142e310404ee85a193 to your computer and use it in GitHub Desktop.
Save boomskats/34baa6ff267556142e310404ee85a193 to your computer and use it in GitHub Desktop.
Ghetto performance test of some SAS code
#!/bin/bash
# Command line method for evaluating performance of SAS code
# In bash, define a function
notquiteesm() ( $* &>/dev/null & pid="$!"; trap ':' INT; echo 'CPU every second'; while sleep 1; do ps --no-headers -o '%cpu' -p "$pid"; done; kill "$pid"; )
# Create some test SAS code in a .sas file that looks like this
%include '/pub/programs/Allianz-backend/init/bafinit.sas';
%bafinit()
%baf_batch_report(slist=applfram.dholap.clpgpwef);
proc print data=bafwork.bafstats2; run;
# run code as so to produce desired output
notquiteesm /pub/sas/SASFoundation/9.4/sas -sysin /tmp/dholapTest.sas -log /tmp/dho_log_$(date +%F_%R).log -print /tmp/dho_out_$(date +%F_%R).lst
CPU every second
98.0
99.0
99.6
99.5
99.6
99.6
99.5
99.7
# the output .lst file created in /tmp will show the detailed stats
Obs method duration count
1 7.412 2
2 'GetData' 6.468 1
3 'BuildMultiDimensionalDataTable' 2.230 1
4 'SubmitSum' 1.989 1
5 'GetDateCutOff' 1.938 2
6 'GetDataSetVariableAttribute' 1.861 7
7 'PRESUMMARYLOOKUP' 0.608 1
8 'GetRequiredClassVariables' 0.303 1
9 'AddCalculatedVariables' 0.251 1
10 'InsertVariableAttributes' 0.239 1
11 'SubmitWhereStatements' 0.236 1
12 'PreSummarySetUp' 0.229 1
13 'GetExchangeRateVariables' 0.207 1
14 'GetCountDistinct' 0.204 1
15 'GetPageByFilters' 0.178 1
16 'ApplyFormats' 0.172 1
17 'SubmitTypes' 0.168 1
18 'crossings' 0.164 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment