Deleted Added
full compact
pmcstat.c (145256) pmcstat.c (145774)
1/*-
2 * Copyright (c) 2003,2004 Joseph Koshy
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

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

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003,2004 Joseph Koshy
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

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

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/usr.sbin/pmcstat/pmcstat.c 145256 2005-04-19 04:01:25Z jkoshy $");
29__FBSDID("$FreeBSD: head/usr.sbin/pmcstat/pmcstat.c 145774 2005-05-01 14:11:49Z jkoshy $");
30
31#include <sys/types.h>
32#include <sys/event.h>
33#include <sys/queue.h>
34#include <sys/time.h>
35#include <sys/ttycom.h>
36#include <sys/wait.h>
37

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

567 ev->ev_cpu, &ev->ev_pmcid) < 0)
568 err(EX_OSERR, "ERROR: Cannot allocate %s-mode pmc with "
569 "specification \"%s\"",
570 PMC_IS_SYSTEM_MODE(ev->ev_mode) ? "system" : "process",
571 ev->ev_spec);
572
573 /* compute printout widths */
574 STAILQ_FOREACH(ev, &args.pa_head, ev_next) {
30
31#include <sys/types.h>
32#include <sys/event.h>
33#include <sys/queue.h>
34#include <sys/time.h>
35#include <sys/ttycom.h>
36#include <sys/wait.h>
37

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

567 ev->ev_cpu, &ev->ev_pmcid) < 0)
568 err(EX_OSERR, "ERROR: Cannot allocate %s-mode pmc with "
569 "specification \"%s\"",
570 PMC_IS_SYSTEM_MODE(ev->ev_mode) ? "system" : "process",
571 ev->ev_spec);
572
573 /* compute printout widths */
574 STAILQ_FOREACH(ev, &args.pa_head, ev_next) {
575 int pmc_width;
576 int pmc_display_width;
577 int pmc_header_width;
575 int counter_width;
576 int display_width;
577 int header_width;
578
578
579 pmc_width = ppmci->pm_pmcs[ev->ev_pmcid].pm_width;
580 pmc_header_width = strlen(ev->ev_name) + 2; /* prefix '%c|' */
581 pmc_display_width = (int) floor(pmc_width / 3.32193) + 1;
579 (void) pmc_width(ev->ev_pmcid, &counter_width);
580 header_width = strlen(ev->ev_name) + 2; /* prefix '%c|' */
581 display_width = (int) floor(counter_width / 3.32193) + 1;
582
582
583 if (pmc_header_width > pmc_display_width) {
583 if (header_width > display_width) {
584 ev->ev_fieldskip = 0;
584 ev->ev_fieldskip = 0;
585 ev->ev_fieldwidth = pmc_header_width;
585 ev->ev_fieldwidth = header_width;
586 } else {
586 } else {
587 ev->ev_fieldskip = pmc_display_width -
588 pmc_header_width;
589 ev->ev_fieldwidth = pmc_display_width;
587 ev->ev_fieldskip = display_width -
588 header_width;
589 ev->ev_fieldwidth = display_width;
590 }
591 }
592
593 /* Allocate a kqueue */
594 if ((pmcstat_kq = kqueue()) < 0)
595 err(EX_OSERR, "ERROR: Cannot allocate kqueue");
596
597 /*

--- 131 unchanged lines hidden ---
590 }
591 }
592
593 /* Allocate a kqueue */
594 if ((pmcstat_kq = kqueue()) < 0)
595 err(EX_OSERR, "ERROR: Cannot allocate kqueue");
596
597 /*

--- 131 unchanged lines hidden ---