Deleted Added
full compact
pdb.c (99829) pdb.c (100107)
1/*
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * 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

--- 16 unchanged lines hidden (view full) ---

25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
1/*
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * 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

--- 16 unchanged lines hidden (view full) ---

25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
33 "$FreeBSD: head/usr.sbin/sa/pdb.c 99829 2002-07-11 22:11:20Z alfred $";
33 "$FreeBSD: head/usr.sbin/sa/pdb.c 100107 2002-07-15 16:05:15Z des $";
34#endif /* not lint */
35
36#include <sys/types.h>
37#include <sys/acct.h>
38#include <err.h>
39#include <errno.h>
40#include <fcntl.h>
34#endif /* not lint */
35
36#include <sys/types.h>
37#include <sys/acct.h>
38#include <err.h>
39#include <errno.h>
40#include <fcntl.h>
41#include <stdint.h>
41#include <stdio.h>
42#include <string.h>
43#include "extern.h"
44#include "pathnames.h"
45
46static int check_junk __P((struct cmdinfo *));
47static void add_ci __P((const struct cmdinfo *, struct cmdinfo *));
48static void print_ci __P((const struct cmdinfo *, const struct cmdinfo *));

--- 255 unchanged lines hidden (view full) ---

304
305static int
306check_junk(cip)
307 struct cmdinfo *cip;
308{
309 char *cp;
310 size_t len;
311
42#include <stdio.h>
43#include <string.h>
44#include "extern.h"
45#include "pathnames.h"
46
47static int check_junk __P((struct cmdinfo *));
48static void add_ci __P((const struct cmdinfo *, struct cmdinfo *));
49static void print_ci __P((const struct cmdinfo *, const struct cmdinfo *));

--- 255 unchanged lines hidden (view full) ---

305
306static int
307check_junk(cip)
308 struct cmdinfo *cip;
309{
310 char *cp;
311 size_t len;
312
312 fprintf(stderr, "%s (%qu) -- ", cip->ci_comm, cip->ci_calls);
313 fprintf(stderr, "%s (%ju) -- ", cip->ci_comm, (uintmax_t)cip->ci_calls);
313 cp = fgetln(stdin, &len);
314
315 return (cp && (cp[0] == 'y' || cp[0] == 'Y')) ? 1 : 0;
316}
317
318static void
319add_ci(fromcip, tocip)
320 const struct cmdinfo *fromcip;

--- 17 unchanged lines hidden (view full) ---

338 c = cip->ci_calls ? cip->ci_calls : 1;
339 t = (cip->ci_utime + cip->ci_stime) / (double) AHZ;
340 if (t < 0.01) {
341 t = 0.01;
342 uflow = 1;
343 } else
344 uflow = 0;
345
314 cp = fgetln(stdin, &len);
315
316 return (cp && (cp[0] == 'y' || cp[0] == 'Y')) ? 1 : 0;
317}
318
319static void
320add_ci(fromcip, tocip)
321 const struct cmdinfo *fromcip;

--- 17 unchanged lines hidden (view full) ---

339 c = cip->ci_calls ? cip->ci_calls : 1;
340 t = (cip->ci_utime + cip->ci_stime) / (double) AHZ;
341 if (t < 0.01) {
342 t = 0.01;
343 uflow = 1;
344 } else
345 uflow = 0;
346
346 printf("%8qu ", cip->ci_calls);
347 printf("%8ju ", (uintmax_t)cip->ci_calls);
347 if (cflag) {
348 if (cip != totalcip)
349 printf(" %4.2f%% ",
350 cip->ci_calls / (double) totalcip->ci_calls);
351 else
352 printf(" %4s ", "");
353 }
354

--- 50 unchanged lines hidden (view full) ---

405 printf("%8.2fre/cp ",
406 cip->ci_etime /
407 (double) (cip->ci_utime + cip->ci_stime));
408 else
409 printf("*ignore* ");
410 }
411
412 if (Dflag)
348 if (cflag) {
349 if (cip != totalcip)
350 printf(" %4.2f%% ",
351 cip->ci_calls / (double) totalcip->ci_calls);
352 else
353 printf(" %4s ", "");
354 }
355

--- 50 unchanged lines hidden (view full) ---

406 printf("%8.2fre/cp ",
407 cip->ci_etime /
408 (double) (cip->ci_utime + cip->ci_stime));
409 else
410 printf("*ignore* ");
411 }
412
413 if (Dflag)
413 printf("%10qutio ", cip->ci_io);
414 printf("%10jutio ", (uintmax_t)cip->ci_io);
414 else
415 printf("%8.0favio ", cip->ci_io / c);
416
417 if (Kflag)
415 else
416 printf("%8.0favio ", cip->ci_io / c);
417
418 if (Kflag)
418 printf("%10quk*sec ", cip->ci_mem);
419 printf("%10juk*sec ", (uintmax_t)cip->ci_mem);
419 else
420 printf("%8.0fk ", cip->ci_mem / t);
421
422 printf(" %s\n", cip->ci_comm);
423}
420 else
421 printf("%8.0fk ", cip->ci_mem / t);
422
423 printf(" %s\n", cip->ci_comm);
424}