|
|
1.1 ! root 1: char xstr[]; ! 2: #line 1 "sh.time.c" ! 3: ! 4: static char sccsid[] = (&xstr[4268]); ! 5: ! 6: ! 7: ! 8: #line 1 "./sh.h" ! 9: ! 10: ! 11: ! 12: #line 1 "./sh.local.h" ! 13: ! 14: ! 15: ! 16: ! 17: ! 18: ! 19: ! 20: ! 21: ! 22: ! 23: ! 24: ! 25: ! 26: ! 27: ! 28: ! 29: ! 30: ! 31: ! 32: ! 33: ! 34: ! 35: ! 36: ! 37: ! 38: ! 39: ! 40: ! 41: ! 42: ! 43: ! 44: ! 45: ! 46: ! 47: ! 48: ! 49: ! 50: ! 51: ! 52: ! 53: ! 54: ! 55: ! 56: ! 57: ! 58: ! 59: #line 51 "./sh.local.h" ! 60: ! 61: #line 4 "./sh.h" ! 62: ! 63: #line 1 "/usr/include/sys/time.h" ! 64: ! 65: ! 66: ! 67: ! 68: ! 69: ! 70: struct timeval { ! 71: long tv_sec; ! 72: long tv_usec; ! 73: }; ! 74: ! 75: struct timezone { ! 76: int tz_minuteswest; ! 77: int tz_dsttime; ! 78: }; ! 79: ! 80: ! 81: ! 82: ! 83: ! 84: ! 85: ! 86: ! 87: ! 88: ! 89: ! 90: ! 91: ! 92: ! 93: ! 94: ! 95: ! 96: ! 97: ! 98: ! 99: ! 100: ! 101: ! 102: ! 103: ! 104: ! 105: struct itimerval { ! 106: struct timeval it_interval; ! 107: struct timeval it_value; ! 108: }; ! 109: ! 110: ! 111: ! 112: ! 113: struct tm { ! 114: int tm_sec; ! 115: int tm_min; ! 116: int tm_hour; ! 117: int tm_mday; ! 118: int tm_mon; ! 119: int tm_year; ! 120: int tm_wday; ! 121: int tm_yday; ! 122: int tm_isdst; ! 123: }; ! 124: ! 125: ! 126: extern struct tm *gmtime(), *localtime(); ! 127: extern char *asctime(), *ctime(); ! 128: ! 129: #line 5 "./sh.h" ! 130: ! 131: #line 1 "/usr/include/sys/resource.h" ! 132: ! 133: ! 134: ! 135: ! 136: ! 137: ! 138: ! 139: ! 140: ! 141: ! 142: ! 143: ! 144: ! 145: ! 146: ! 147: ! 148: ! 149: ! 150: ! 151: struct rusage { ! 152: struct timeval ru_utime; ! 153: struct timeval ru_stime; ! 154: long ru_maxrss; ! 155: ! 156: long ru_ixrss; ! 157: long ru_idrss; ! 158: long ru_isrss; ! 159: long ru_minflt; ! 160: long ru_majflt; ! 161: long ru_nswap; ! 162: long ru_inblock; ! 163: long ru_oublock; ! 164: long ru_msgsnd; ! 165: long ru_msgrcv; ! 166: long ru_nsignals; ! 167: long ru_nvcsw; ! 168: long ru_nivcsw; ! 169: ! 170: }; ! 171: ! 172: ! 173: ! 174: ! 175: ! 176: ! 177: ! 178: ! 179: ! 180: ! 181: ! 182: ! 183: ! 184: ! 185: ! 186: struct rlimit { ! 187: int rlim_cur; ! 188: int rlim_max; ! 189: }; ! 190: #line 6 "./sh.h" ! 191: ! 192: ! 193: ! 194: ! 195: ! 196: ! 197: ! 198: ! 199: ! 200: ! 201: ! 202: #line 1 "/usr/include/sys/param.h" ! 203: ! 204: ! 205: ! 206: ! 207: ! 208: #line 8 "/usr/include/sys/param.h" ! 209: ! 210: ! 211: #line 1 "/usr/include/machine/param.h" ! 212: ! 213: ! 214: ! 215: ! 216: ! 217: ! 218: ! 219: ! 220: ! 221: ! 222: ! 223: ! 224: ! 225: ! 226: ! 227: ! 228: ! 229: ! 230: ! 231: ! 232: ! 233: ! 234: ! 235: ! 236: ! 237: ! 238: ! 239: ! 240: ! 241: ! 242: ! 243: ! 244: ! 245: ! 246: ! 247: ! 248: ! 249: ! 250: ! 251: ! 252: ! 253: ! 254: ! 255: ! 256: ! 257: ! 258: #line 10 "/usr/include/sys/param.h" ! 259: ! 260: ! 261: ! 262: ! 263: ! 264: ! 265: ! 266: ! 267: ! 268: ! 269: ! 270: ! 271: ! 272: ! 273: ! 274: ! 275: ! 276: ! 277: ! 278: ! 279: ! 280: ! 281: ! 282: ! 283: ! 284: ! 285: ! 286: ! 287: ! 288: ! 289: ! 290: ! 291: ! 292: ! 293: ! 294: ! 295: ! 296: #line 49 "/usr/include/sys/param.h" ! 297: ! 298: ! 299: #line 1 "/usr/include/signal.h" ! 300: ! 301: ! 302: ! 303: ! 304: ! 305: ! 306: ! 307: ! 308: ! 309: ! 310: ! 311: ! 312: ! 313: ! 314: ! 315: ! 316: ! 317: ! 318: ! 319: ! 320: ! 321: ! 322: ! 323: ! 324: ! 325: ! 326: ! 327: ! 328: ! 329: ! 330: ! 331: ! 332: ! 333: ! 334: ! 335: ! 336: ! 337: ! 338: ! 339: ! 340: ! 341: ! 342: ! 343: ! 344: ! 345: ! 346: ! 347: ! 348: int (*signal())(); ! 349: ! 350: ! 351: ! 352: ! 353: ! 354: struct sigvec { ! 355: int (*sv_handler)(); ! 356: int sv_mask; ! 357: int sv_onstack; ! 358: }; ! 359: ! 360: ! 361: ! 362: ! 363: struct sigstack { ! 364: char *ss_sp; ! 365: int ss_onstack; ! 366: }; ! 367: ! 368: ! 369: ! 370: ! 371: ! 372: ! 373: ! 374: ! 375: struct sigcontext { ! 376: int sc_onstack; ! 377: int sc_mask; ! 378: int sc_sp; ! 379: int sc_pc; ! 380: int sc_ps; ! 381: }; ! 382: ! 383: ! 384: ! 385: ! 386: ! 387: #line 91 "/usr/include/signal.h" ! 388: ! 389: ! 390: #line 51 "/usr/include/sys/param.h" ! 391: ! 392: ! 393: ! 394: ! 395: ! 396: ! 397: ! 398: ! 399: ! 400: ! 401: ! 402: ! 403: ! 404: ! 405: ! 406: ! 407: ! 408: ! 409: ! 410: ! 411: ! 412: ! 413: ! 414: ! 415: ! 416: ! 417: ! 418: ! 419: ! 420: ! 421: ! 422: ! 423: ! 424: ! 425: #line 90 "/usr/include/sys/param.h" ! 426: ! 427: ! 428: ! 429: ! 430: ! 431: ! 432: ! 433: ! 434: ! 435: ! 436: ! 437: ! 438: ! 439: #line 1 "/usr/include/sys/types.h" ! 440: ! 441: ! 442: ! 443: ! 444: ! 445: ! 446: ! 447: ! 448: ! 449: ! 450: ! 451: ! 452: ! 453: ! 454: ! 455: typedef unsigned char u_char; ! 456: typedef unsigned short u_short; ! 457: typedef unsigned int u_int; ! 458: typedef unsigned long u_long; ! 459: typedef unsigned short ushort; ! 460: ! 461: ! 462: typedef struct _physadr { int r[1]; } *physadr; ! 463: typedef struct label_t { ! 464: int val[14]; ! 465: } label_t; ! 466: ! 467: typedef struct _quad { long val[2]; } quad; ! 468: typedef long daddr_t; ! 469: typedef char * caddr_t; ! 470: typedef u_long ino_t; ! 471: typedef long swblk_t; ! 472: typedef int size_t; ! 473: typedef int time_t; ! 474: typedef short dev_t; ! 475: typedef int off_t; ! 476: ! 477: typedef struct fd_set { int fds_bits[1]; } fd_set; ! 478: #line 103 "/usr/include/sys/param.h" ! 479: #line 107 "/usr/include/sys/param.h" ! 480: ! 481: ! 482: ! 483: ! 484: ! 485: ! 486: ! 487: ! 488: ! 489: ! 490: ! 491: ! 492: ! 493: ! 494: ! 495: ! 496: ! 497: ! 498: ! 499: ! 500: ! 501: ! 502: ! 503: ! 504: ! 505: ! 506: ! 507: ! 508: ! 509: ! 510: ! 511: ! 512: ! 513: ! 514: ! 515: ! 516: ! 517: ! 518: ! 519: ! 520: ! 521: ! 522: ! 523: ! 524: ! 525: ! 526: ! 527: ! 528: ! 529: ! 530: ! 531: ! 532: ! 533: ! 534: ! 535: ! 536: ! 537: ! 538: ! 539: ! 540: ! 541: ! 542: ! 543: ! 544: ! 545: ! 546: ! 547: ! 548: ! 549: ! 550: ! 551: ! 552: ! 553: #line 17 "./sh.h" ! 554: ! 555: #line 1 "/usr/include/sys/stat.h" ! 556: ! 557: ! 558: struct stat ! 559: { ! 560: dev_t st_dev; ! 561: ino_t st_ino; ! 562: unsigned short st_mode; ! 563: short st_nlink; ! 564: short st_uid; ! 565: short st_gid; ! 566: dev_t st_rdev; ! 567: off_t st_size; ! 568: time_t st_atime; ! 569: int st_spare1; ! 570: time_t st_mtime; ! 571: int st_spare2; ! 572: time_t st_ctime; ! 573: int st_spare3; ! 574: long st_blksize; ! 575: long st_blocks; ! 576: long st_spare4[2]; ! 577: }; ! 578: ! 579: ! 580: ! 581: ! 582: ! 583: ! 584: ! 585: ! 586: ! 587: ! 588: ! 589: ! 590: ! 591: ! 592: #line 18 "./sh.h" ! 593: ! 594: ! 595: ! 596: ! 597: #line 1 "/usr/include/errno.h" ! 598: ! 599: ! 600: ! 601: ! 602: ! 603: ! 604: ! 605: ! 606: ! 607: ! 608: ! 609: ! 610: ! 611: ! 612: ! 613: ! 614: ! 615: ! 616: ! 617: ! 618: ! 619: ! 620: ! 621: ! 622: ! 623: ! 624: ! 625: ! 626: ! 627: ! 628: ! 629: ! 630: ! 631: ! 632: ! 633: ! 634: ! 635: ! 636: ! 637: ! 638: ! 639: ! 640: ! 641: ! 642: ! 643: ! 644: ! 645: ! 646: ! 647: ! 648: ! 649: ! 650: ! 651: ! 652: ! 653: ! 654: ! 655: ! 656: ! 657: ! 658: ! 659: ! 660: ! 661: ! 662: ! 663: ! 664: ! 665: ! 666: ! 667: ! 668: ! 669: ! 670: ! 671: ! 672: ! 673: ! 674: ! 675: ! 676: ! 677: ! 678: ! 679: ! 680: ! 681: ! 682: ! 683: ! 684: ! 685: ! 686: ! 687: ! 688: #line 22 "./sh.h" ! 689: ! 690: #line 1 "/usr/include/setjmp.h" ! 691: ! 692: ! 693: typedef int jmp_buf[14]; ! 694: #line 23 "./sh.h" ! 695: ! 696: #line 1 "/usr/include/signal.h" ! 697: ! 698: ! 699: ! 700: ! 701: ! 702: ! 703: ! 704: ! 705: ! 706: ! 707: ! 708: ! 709: #line 92 "/usr/include/signal.h" ! 710: ! 711: #line 24 "./sh.h" ! 712: ! 713: #line 1 "/usr/include/sys/times.h" ! 714: ! 715: ! 716: ! 717: ! 718: ! 719: struct tms { ! 720: time_t tms_utime; ! 721: time_t tms_stime; ! 722: time_t tms_cutime; ! 723: time_t tms_cstime; ! 724: }; ! 725: #line 25 "./sh.h" ! 726: ! 727: typedef char bool; ! 728: ! 729: ! 730: ! 731: ! 732: ! 733: ! 734: ! 735: ! 736: ! 737: ! 738: ! 739: ! 740: ! 741: bool chkstop; ! 742: bool didcch; ! 743: bool didfds; ! 744: bool doneinp; ! 745: bool exiterr; ! 746: bool child; ! 747: bool haderr; ! 748: bool intty; ! 749: bool intact; ! 750: bool justpr; ! 751: bool loginsh; ! 752: bool neednote; ! 753: bool noexec; ! 754: bool pjobs; ! 755: bool setintr; ! 756: bool timflg; ! 757: ! 758: ! 759: ! 760: ! 761: char *arginp; ! 762: int onelflg; ! 763: char *file; ! 764: ! 765: char *err; ! 766: int errno; ! 767: char *shtemp; ! 768: struct timeval time0; ! 769: struct rusage ru0; ! 770: ! 771: ! 772: ! 773: ! 774: char *doldol; ! 775: int uid; ! 776: time_t chktim; ! 777: int shpgrp; ! 778: int tpgrp; ! 779: ! 780: int opgrp; ! 781: int oldisc; ! 782: struct tms shtimes; ! 783: ! 784: ! 785: ! 786: ! 787: ! 788: ! 789: struct biltins { ! 790: char *bname; ! 791: int (*bfunct)(); ! 792: short minargs, maxargs; ! 793: } bfunc[]; ! 794: ! 795: ! 796: ! 797: struct srch { ! 798: char *s_name; ! 799: short s_value; ! 800: } srchn[]; ! 801: ! 802: ! 803: ! 804: ! 805: ! 806: ! 807: ! 808: ! 809: ! 810: short SHIN; ! 811: short SHOUT; ! 812: short SHDIAG; ! 813: short OLDSTD; ! 814: ! 815: ! 816: ! 817: ! 818: ! 819: ! 820: ! 821: ! 822: ! 823: jmp_buf reslab; ! 824: ! 825: ! 826: ! 827: ! 828: ! 829: ! 830: ! 831: char *gointr; ! 832: int (*parintr)(); ! 833: int (*parterm)(); ! 834: ! 835: ! 836: ! 837: ! 838: ! 839: ! 840: ! 841: ! 842: ! 843: ! 844: ! 845: ! 846: ! 847: ! 848: ! 849: ! 850: ! 851: ! 852: struct Bin { ! 853: off_t Bfseekp; ! 854: off_t Bfbobp; ! 855: off_t Bfeobp; ! 856: short Bfblocks; ! 857: char **Bfbuf; ! 858: } B; ! 859: ! 860: ! 861: ! 862: ! 863: ! 864: ! 865: ! 866: off_t btell(); ! 867: ! 868: ! 869: ! 870: ! 871: ! 872: ! 873: off_t lineloc; ! 874: ! 875: ! 876: off_t tell(); ! 877: bool cantell; ! 878: ! 879: ! 880: ! 881: ! 882: ! 883: ! 884: struct wordent { ! 885: char *word; ! 886: struct wordent *prev; ! 887: struct wordent *next; ! 888: }; ! 889: ! 890: ! 891: ! 892: ! 893: ! 894: ! 895: ! 896: ! 897: ! 898: ! 899: ! 900: ! 901: ! 902: ! 903: ! 904: ! 905: ! 906: ! 907: ! 908: ! 909: ! 910: char labuf[1024 ]; ! 911: ! 912: char *lap; ! 913: ! 914: ! 915: ! 916: ! 917: ! 918: ! 919: ! 920: ! 921: struct command { ! 922: short t_dtyp; ! 923: short t_dflg; ! 924: union { ! 925: char *T_dlef; ! 926: struct command *T_dcar; ! 927: } L; ! 928: union { ! 929: char *T_drit; ! 930: struct command *T_dcdr; ! 931: } R; ! 932: ! 933: ! 934: ! 935: ! 936: char **t_dcom; ! 937: struct command *t_dspr; ! 938: short t_nice; ! 939: }; ! 940: ! 941: ! 942: ! 943: ! 944: ! 945: ! 946: ! 947: ! 948: ! 949: ! 950: ! 951: ! 952: ! 953: ! 954: ! 955: ! 956: ! 957: ! 958: ! 959: ! 960: ! 961: ! 962: ! 963: ! 964: ! 965: ! 966: ! 967: ! 968: ! 969: ! 970: ! 971: ! 972: ! 973: ! 974: ! 975: ! 976: ! 977: ! 978: ! 979: ! 980: ! 981: ! 982: ! 983: ! 984: ! 985: ! 986: ! 987: ! 988: ! 989: ! 990: ! 991: ! 992: ! 993: struct whyle { ! 994: off_t w_start; ! 995: off_t w_end; ! 996: char **w_fe, **w_fe0; ! 997: char *w_fename; ! 998: struct whyle *w_next; ! 999: } *whyles; ! 1000: ! 1001: ! 1002: ! 1003: ! 1004: ! 1005: ! 1006: struct varent { ! 1007: char **vec; ! 1008: char *name; ! 1009: struct varent *link; ! 1010: } shvhed, aliases; ! 1011: ! 1012: ! 1013: ! 1014: ! 1015: ! 1016: struct wordent *alhistp; ! 1017: struct wordent *alhistt; ! 1018: char **alvec; ! 1019: ! 1020: ! 1021: ! 1022: ! 1023: short gflag; ! 1024: ! 1025: ! 1026: ! 1027: ! 1028: ! 1029: ! 1030: ! 1031: ! 1032: ! 1033: ! 1034: char **gargv; ! 1035: short gargc; ! 1036: short gnleft; ! 1037: ! 1038: ! 1039: ! 1040: ! 1041: char **pargv; ! 1042: char *pargs; ! 1043: short pargc; ! 1044: short pnleft; ! 1045: char *pargcp; ! 1046: ! 1047: ! 1048: ! 1049: ! 1050: ! 1051: ! 1052: ! 1053: ! 1054: ! 1055: ! 1056: ! 1057: ! 1058: struct Hist { ! 1059: struct wordent Hlex; ! 1060: int Hnum; ! 1061: int Href; ! 1062: struct Hist *Hnext; ! 1063: } Histlist; ! 1064: ! 1065: struct wordent paraml; ! 1066: int eventno; ! 1067: int lastev; ! 1068: ! 1069: char HIST; ! 1070: char HISTSUB; ! 1071: ! 1072: char *Dfix1(); ! 1073: struct varent *adrof(), *adrof1(); ! 1074: char **blkcat(); ! 1075: char **blkcpy(); ! 1076: char **blkend(); ! 1077: char **blkspl(); ! 1078: char *calloc(); ! 1079: char *cname(); ! 1080: char **copyblk(); ! 1081: char **dobackp(); ! 1082: char *domod(); ! 1083: struct wordent *dosub(); ! 1084: char *exp3(); ! 1085: char *exp3a(); ! 1086: char *exp4(); ! 1087: char *exp5(); ! 1088: char *exp6(); ! 1089: struct Hist *enthist(); ! 1090: struct Hist *findev(); ! 1091: struct wordent *freenod(); ! 1092: char *getenv(); ! 1093: char *getinx(); ! 1094: struct varent *getvx(); ! 1095: struct passwd *getpwnam(); ! 1096: struct wordent *gethent(); ! 1097: struct wordent *getsub(); ! 1098: char *getwd(); ! 1099: char *globone(); ! 1100: struct biltins *isbfunc(); ! 1101: char **glob(); ! 1102: char *operate(); ! 1103: int phup(); ! 1104: int pintr(); ! 1105: int pchild(); ! 1106: char *putn(); ! 1107: char **saveblk(); ! 1108: char *savestr(); ! 1109: char *strcat(); ! 1110: char *strcpy(); ! 1111: char *strend(); ! 1112: char *strings(); ! 1113: char *strip(); ! 1114: char *strspl(); ! 1115: char *subword(); ! 1116: struct command *syntax(); ! 1117: struct command *syn0(); ! 1118: struct command *syn1(); ! 1119: struct command *syn1a(); ! 1120: struct command *syn1b(); ! 1121: struct command *syn2(); ! 1122: struct command *syn3(); ! 1123: int tglob(); ! 1124: int trim(); ! 1125: char *value(), *value1(); ! 1126: char *xhome(); ! 1127: char *xname(); ! 1128: char *xset(); ! 1129: ! 1130: ! 1131: ! 1132: ! 1133: ! 1134: ! 1135: char *bname; ! 1136: ! 1137: ! 1138: ! 1139: char *Vsav; ! 1140: char **Vav; ! 1141: char *Vdp; ! 1142: ! 1143: ! 1144: char **evalvec; ! 1145: char *evalp; ! 1146: ! 1147: struct mesg { ! 1148: char *iname; ! 1149: char *pname; ! 1150: } mesg[]; ! 1151: #line 6 "sh.time.c" ! 1152: ! 1153: ! 1154: ! 1155: ! 1156: struct tms times0; ! 1157: struct tms timesdol; ! 1158: ! 1159: settimes() ! 1160: { ! 1161: struct rusage ruch; ! 1162: ! 1163: gettimeofday(&time0, (struct timezone *)0); ! 1164: getrusage(0, &ru0); ! 1165: getrusage(-1, &ruch); ! 1166: ruadd(&ru0, &ruch); ! 1167: } ! 1168: ! 1169: ! 1170: ! 1171: ! 1172: ! 1173: dotime() ! 1174: { ! 1175: struct timeval timedol; ! 1176: struct rusage ru1, ruch; ! 1177: ! 1178: getrusage(0, &ru1); ! 1179: getrusage(-1, &ruch); ! 1180: ruadd(&ru1, &ruch); ! 1181: gettimeofday(&timedol, (struct timezone *)0); ! 1182: prusage(&ru0, &ru1, &timedol, &time0); ! 1183: } ! 1184: ! 1185: ! 1186: ! 1187: ! 1188: donice(v) ! 1189: register char **v; ! 1190: { ! 1191: register char *cp; ! 1192: ! 1193: v++, cp = *v++; ! 1194: if (cp == 0) { ! 1195: ! 1196: nice(20); ! 1197: nice(-10); ! 1198: ! 1199: nice(4); ! 1200: } else if (*v == 0 && any(cp[0], (&xstr[1099]))) { ! 1201: ! 1202: nice(20); ! 1203: nice(-10); ! 1204: ! 1205: nice(getn(cp)); ! 1206: } ! 1207: } ! 1208: ! 1209: ruadd(ru, ru2) ! 1210: register struct rusage *ru, *ru2; ! 1211: { ! 1212: register long *lp, *lp2; ! 1213: register int cnt; ! 1214: ! 1215: tvadd(&ru->ru_utime, &ru2->ru_utime); ! 1216: tvadd(&ru->ru_stime, &ru2->ru_stime); ! 1217: if (ru2->ru_maxrss > ru->ru_maxrss) ! 1218: ru->ru_maxrss = ru2->ru_maxrss; ! 1219: cnt = &ru-> ru_nivcsw - &ru->ru_ixrss + 1; ! 1220: lp = &ru->ru_ixrss; lp2 = &ru2->ru_ixrss; ! 1221: do ! 1222: *lp++ += *lp2++; ! 1223: while (--cnt > 0); ! 1224: } ! 1225: ! 1226: prusage(r0, r1, e, b) ! 1227: register struct rusage *r0, *r1; ! 1228: struct timeval *e, *b; ! 1229: { ! 1230: register time_t t = ! 1231: (r1->ru_utime.tv_sec-r0->ru_utime.tv_sec)*100+ ! 1232: (r1->ru_utime.tv_usec-r0->ru_utime.tv_usec)/10000+ ! 1233: (r1->ru_stime.tv_sec-r0->ru_stime.tv_sec)*100+ ! 1234: (r1->ru_stime.tv_usec-r0->ru_stime.tv_usec)/10000; ! 1235: register char *cp; ! 1236: register int i; ! 1237: register struct varent *vp = adrof((&xstr[1493])); ! 1238: int ms = ! 1239: (e->tv_sec-b->tv_sec)*100 + (e->tv_usec-b->tv_usec)/10000; ! 1240: ! 1241: cp = (&xstr[4305]); ! 1242: if (vp && vp->vec[0] && vp->vec[1]) ! 1243: cp = vp->vec[1]; ! 1244: for (; *cp; cp++) ! 1245: if (*cp != '%') ! 1246: putchar(*cp); ! 1247: else if (cp[1]) switch(*++cp) { ! 1248: ! 1249: case 'U': ! 1250: pdeltat(&r1->ru_utime, &r0->ru_utime); ! 1251: break; ! 1252: ! 1253: case 'S': ! 1254: pdeltat(&r1->ru_stime, &r0->ru_stime); ! 1255: break; ! 1256: ! 1257: case 'E': ! 1258: psecs(ms / 100); ! 1259: break; ! 1260: ! 1261: case 'P': ! 1262: printf((&xstr[4343]), (int) (t*100 / ((ms ? ms : 1)))); ! 1263: break; ! 1264: ! 1265: case 'W': ! 1266: i = r1->ru_nswap - r0->ru_nswap; ! 1267: printf((&xstr[3573]), i); ! 1268: break; ! 1269: ! 1270: case 'X': ! 1271: printf((&xstr[3573]), t == 0 ? 0 : (r1->ru_ixrss-r0->ru_ixrss)/t); ! 1272: break; ! 1273: ! 1274: case 'D': ! 1275: printf((&xstr[3573]), t == 0 ? 0 : ! 1276: (r1->ru_idrss+r1->ru_isrss-(r0->ru_idrss+r0->ru_isrss))/t); ! 1277: break; ! 1278: ! 1279: case 'K': ! 1280: printf((&xstr[3573]), t == 0 ? 0 : ! 1281: ((r1->ru_ixrss+r1->ru_isrss+r1->ru_idrss) - ! 1282: (r0->ru_ixrss+r0->ru_idrss+r0->ru_isrss))/t); ! 1283: break; ! 1284: ! 1285: case 'M': ! 1286: printf((&xstr[3573]), r1->ru_maxrss/2); ! 1287: break; ! 1288: ! 1289: case 'F': ! 1290: printf((&xstr[3573]), r1->ru_majflt-r0->ru_majflt); ! 1291: break; ! 1292: ! 1293: case 'R': ! 1294: printf((&xstr[3573]), r1->ru_minflt-r0->ru_minflt); ! 1295: break; ! 1296: ! 1297: case 'I': ! 1298: printf((&xstr[3573]), r1->ru_inblock-r0->ru_inblock); ! 1299: break; ! 1300: ! 1301: case 'O': ! 1302: printf((&xstr[3573]), r1->ru_oublock-r0->ru_oublock); ! 1303: break; ! 1304: } ! 1305: putchar('\n'); ! 1306: } ! 1307: ! 1308: pdeltat(t1, t0) ! 1309: struct timeval *t1, *t0; ! 1310: { ! 1311: struct timeval td; ! 1312: ! 1313: tvsub(&td, t1, t0); ! 1314: printf((&xstr[4348]), td.tv_sec, td.tv_usec/100000); ! 1315: } ! 1316: ! 1317: tvadd(tsum, t0) ! 1318: struct timeval *tsum, *t0; ! 1319: { ! 1320: ! 1321: tsum->tv_sec += t0->tv_sec; ! 1322: tsum->tv_usec += t0->tv_usec; ! 1323: if (tsum->tv_usec > 1000000) ! 1324: tsum->tv_sec++, tsum->tv_usec -= 1000000; ! 1325: } ! 1326: ! 1327: tvsub(tdiff, t1, t0) ! 1328: struct timeval *tdiff, *t1, *t0; ! 1329: { ! 1330: ! 1331: tdiff->tv_sec = t1->tv_sec - t0->tv_sec; ! 1332: tdiff->tv_usec = t1->tv_usec - t0->tv_usec; ! 1333: if (tdiff->tv_usec < 0) ! 1334: tdiff->tv_sec--, tdiff->tv_usec += 1000000; ! 1335: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.