print.c (109504) | print.c (110391) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#if 0 35#ifndef lint 36static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; 37#endif /* not lint */ 38#endif | 1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#if 0 35#ifndef lint 36static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; 37#endif /* not lint */ 38#endif |
39 |
|
39#include <sys/cdefs.h> | 40#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/bin/ps/print.c 109504 2003-01-19 00:31:16Z jmallett $"); | 41__FBSDID("$FreeBSD: head/bin/ps/print.c 110391 2003-02-05 13:18:17Z charnier $"); |
41 42#include <sys/param.h> 43#include <sys/time.h> 44#include <sys/resource.h> 45#include <sys/proc.h> 46#include <sys/stat.h> 47 48#include <sys/mac.h> --- 485 unchanged lines hidden (view full) --- 534 "%3ld:%02ld%c%02ld", secs/60, secs%60, decimal_point, psecs); 535 (void)printf("%*s", v->width, obuff); 536} 537 538void 539elapsed(KINFO *k, VARENT *ve) 540{ 541 VAR *v; | 42 43#include <sys/param.h> 44#include <sys/time.h> 45#include <sys/resource.h> 46#include <sys/proc.h> 47#include <sys/stat.h> 48 49#include <sys/mac.h> --- 485 unchanged lines hidden (view full) --- 535 "%3ld:%02ld%c%02ld", secs/60, secs%60, decimal_point, psecs); 536 (void)printf("%*s", v->width, obuff); 537} 538 539void 540elapsed(KINFO *k, VARENT *ve) 541{ 542 VAR *v; |
542 time_t secs; | 543 time_t days, hours, mins, secs; |
543 char obuff[128]; 544 545 v = ve->var; 546 547 secs = now - k->ki_p->ki_start.tv_sec; | 544 char obuff[128]; 545 546 v = ve->var; 547 548 secs = now - k->ki_p->ki_start.tv_sec; |
548 (void)snprintf(obuff, sizeof(obuff), "%3ld:%02ld", (long)secs/60, 549 (long)secs%60); | 549 days = secs/(24*60*60); 550 secs %= (24*60*60); 551 hours = secs/(60*60); 552 secs %= (60*60); 553 mins = secs/60; 554 secs %= 60; 555 if (days != 0) { 556 (void)snprintf(obuff, sizeof(obuff), "%3ld-%02ld:%02ld:%02ld", 557 (long)days, (long)hours, (long)mins, (long)secs); 558 } 559 else if (hours != 0) { 560 (void)snprintf(obuff, sizeof(obuff), "%02ld:%02ld:%02ld", 561 (long)hours, (long)mins, (long)secs); 562 } 563 else { 564 (void)snprintf(obuff, sizeof(obuff), "%02ld:%02ld", 565 (long)mins, (long)secs); 566 } |
550 (void)printf("%*s", v->width, obuff); 551} 552 553double 554getpcpu(const KINFO *k) 555{ 556 static int failure; 557 --- 230 unchanged lines hidden --- | 567 (void)printf("%*s", v->width, obuff); 568} 569 570double 571getpcpu(const KINFO *k) 572{ 573 static int failure; 574 --- 230 unchanged lines hidden --- |