Date: Wed, 28 Nov 2007 19:51:55 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 129717 for review Message-ID: <200711281951.lASJptLS028740@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711281951.lASJptLS028740>