source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUSTAT1.m@ 1458

Last change on this file since 1458 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.8 KB
Line 
1XUSTAT1 ;SF/RWF - User/CPU stats part 2 ;9/9/91 09:19 ;
2 ;;8.0;KERNEL;;Jul 10, 1995
3 U IO S (XUTREC,XUNODT,XUNOSER,XUNOTM)=0,XUDT=XUST-.000001,(XU1,XU2)=1,XUSTSK(1)="BT"[XUSTSK,XUSTSK(2)="BU"[XUSTSK
4 F I=1:1 S XUDT=$O(^XUSEC(0,XUDT)) Q:(XUDT'>0)!(XUDT>XUEN) S XUVAL=^XUSEC(0,XUDT,0) D SELCT
5 G ^XUSTAT2
6 ;
7SELCT S XUTREC=XUTREC+1,XUDATE=$P(XUVAL,U,4),XUCPU=$P(XUVAL,U,5),XUNAME(XUCPU)="",XUDUZ=+XUVAL S:'$L(XUCPU) XUCPU="UNKNOWN" S:'$L(XUDATE) XUNODT=XUNODT+1 S:$P(XUVAL,U,6) XUNOTM=XUNOTM+1
8 S XUTIME=0 I XUDATE S X=XUDT D H^%DTC S XUI(1)=%H,XUI(2)=%T,X=XUDATE D H^%DTC S XUTIME=(%H-XUI(1)*86400)+(%T-XUI(2))
9 S X=$P(XUVAL,U,6)
10 I (XUSTSK(1)&X)!(XUSTSK(2)&'X) D PROC:XUSORT="V",USER:XUSORT="U",SERV:XUSORT="S",DEV:XUSORT="D"
11 Q
12PROC ;By processer
13 I XUSS Q:'$D(XUSS(XUCPU))
14 I XUDUZ S ^(XUDUZ)=$G(^TMP($J,"DUZ",XUCPU,XUDUZ))+1
15 S:'$D(XUNAME(XUCPU))#2 XUNAME(XUCPU)=0
16 Q:'XUDATE S XU1=XUCPU D CALC Q
17CALC ;
18 S ^TMP($J,"TIME",XU1,XU2)=$G(^TMP($J,"TIME",XU1,XU2))+XUTIME
19 Q
20USER ;By user
21 I XUSS Q:'$D(XUSS(XUDUZ))
22 S:'$D(XUNAME(XUCPU))#2 XUNAME(XUCPU)=0 G:'XUDUZ UX
23 I 'XUSS S ^TMP($J,0,$P(^VA(200,XUDUZ,0),U,1))=XUDUZ
24 S ^(XUCPU)=$G(^TMP($J,"CPU",XUDUZ,XUCPU))+1
25 S:'XUDATE ^(XUCPU)=$G(^TMP($J,"NODAT",XUDUZ,XUCPU))+1
26UX Q:'XUDATE S XU1=XUDUZ,XU2=XUCPU D CALC
27 Q
28DEV ;By device
29 S XUDEV=$S($P(XUVAL,"^",9)]"":$P(XUVAL,"^",9),1:$P(XUVAL,"^",7)) Q:XUDEV']""
30 I XUSS Q:'$D(XUSS(XUDEV))
31 S ^(XUCPU)=$G(^TMP($J,"DEV",XUDEV,XUCPU))+1
32 S:'XUDATE ^(XUCPU)=$G(^TMP($J,"NODAT",XUDEV,XUCPU))+1
33 Q:'XUDATE S XU1=XUDEV,XU2=XUCPU D CALC
34 Q
35SERV ;By service
36 S X=+$G(^VA(200,XUDUZ,5)),XUSER=$S($D(^DIC(49,X,0)):$P(^(0),U,1),1:"UNKNOWN")
37 I XUSS Q:'$D(XUSS(X))&(XUSER'="UNKNOWN")
38 S:'$D(^TMP($J,"SER",XUSER))#2 ^TMP($J,"SER",XUSER)=0
39 S ^(XUSER)=$G(^TMP($J,"SER",XUSER))+1
40 Q:'XUDATE S XU1=XUSER D CALC Q
41 Q
Note: See TracBrowser for help on using the repository browser.