From owner-p4-projects@FreeBSD.ORG Wed Nov 28 19:51:56 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 78F7216A4C4; Wed, 28 Nov 2007 19:51:56 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FAD516A417 for ; Wed, 28 Nov 2007 19:51:56 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 14F1E13C442 for ; Wed, 28 Nov 2007 19:51:56 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lASJptSq028743 for ; Wed, 28 Nov 2007 19:51:55 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lASJptLS028740 for perforce@freebsd.org; Wed, 28 Nov 2007 19:51:55 GMT (envelope-from peter@freebsd.org) Date: Wed, 28 Nov 2007 19:51:55 GMT Message-Id: <200711281951.lASJptLS028740@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 129717 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2007 19:51:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=129717 Change 129717 by peter@peter_overcee on 2007/11/28 19:51:37 Switch from -C to -P (pcpu) to sync with top Affected files ... .. //depot/projects/hammer/usr.bin/vmstat/vmstat.c#27 edit Differences ... ==== //depot/projects/hammer/usr.bin/vmstat/vmstat.c#27 (text+ko) ==== @@ -138,7 +138,7 @@ static int winlines = 20; static int aflag; static int nflag; -static int Cflag; +static int Pflag; static int hflag; static kvm_t *kd; @@ -152,7 +152,7 @@ #define ZMEMSTAT 0x40 static void cpustats(void); -static void Cpustats(int, u_long, int); +static void pcpustats(int, u_long, int); static void devstats(void); static void doforkst(void); static void dointr(void); @@ -185,7 +185,7 @@ interval = reps = todo = 0; maxshowdevs = 2; hflag = isatty(1); - while ((c = getopt(argc, argv, "ac:CfhHiM:mN:n:p:stw:z")) != -1) { + while ((c = getopt(argc, argv, "ac:fhHiM:mN:n:Pp:stw:z")) != -1) { switch (c) { case 'a': aflag++; @@ -193,8 +193,8 @@ case 'c': reps = atoi(optarg); break; - case 'C': - Cflag++; + case 'P': + Pflag++; break; case 'f': todo |= FORKSTAT; @@ -275,8 +275,8 @@ warnx("kvm_nlist: %s", kvm_geterr(kd)); exit(1); } - if (kd && Cflag) - errx(1, "Cannot use -C with crash dumps"); + if (kd && Pflag) + errx(1, "Cannot use -P with crash dumps"); if (todo & VMSTAT) { struct winsize winsize; @@ -598,7 +598,7 @@ hz = clockrate.hz; } - if (Cflag) { + if (Pflag) { ncpus = getcpuinfo(&cpumask, &maxid); size_cp_times = sizeof(long) * (maxid + 1) * CPUSTATES; cur_cp_times = malloc(size_cp_times); @@ -617,7 +617,7 @@ if (size != sizeof(cur.cp_time)) errx(1, "cp_time size mismatch"); } - if (Cflag) { + if (Pflag) { size = size_cp_times; mysysctl("kern.cp_times", cur_cp_times, &size, NULL, 0); if (size != size_cp_times) @@ -703,8 +703,8 @@ (unsigned long)rate(sum.v_intr - osum.v_intr), (unsigned long)rate(sum.v_syscall - osum.v_syscall), (unsigned long)rate(sum.v_swtch - osum.v_swtch)); - if (Cflag) - Cpustats(ncpus, cpumask, maxid); + if (Pflag) + pcpustats(ncpus, cpumask, maxid); else cpustats(); (void)printf("\n"); @@ -737,7 +737,7 @@ else if (num_shown == 1) (void)printf("disk"); (void)printf(" faults "); - if (Cflag) { + if (Pflag) { for (i = 0; i < ncpus; i++) { if (cpumask && (1ul << i)) printf("cpu%-2d ", i); @@ -753,7 +753,7 @@ dev_select[i].device_name[1], dev_select[i].unit_number); (void)printf(" in sy cs"); - if (Cflag) { + if (Pflag) { for (i = 0; i < ncpus; i++) printf(" us sy id"); printf("\n"); @@ -967,7 +967,7 @@ } static void -Cpustats(int ncpus, u_long cpumask, int maxid) +pcpustats(int ncpus, u_long cpumask, int maxid) { int state, i; double lpct, total;