From owner-svn-src-stable-9@FreeBSD.ORG Mon Jul 2 07:14:22 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 23BB61065673; Mon, 2 Jul 2012 07:14:22 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DE798FC15; Mon, 2 Jul 2012 07:14:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q627ELOu053740; Mon, 2 Jul 2012 07:14:21 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q627ELRs053733; Mon, 2 Jul 2012 07:14:21 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201207020714.q627ELRs053733@svn.freebsd.org> From: "David E. O'Brien" Date: Mon, 2 Jul 2012 07:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237969 - in stable/9/usr.sbin: pmccontrol pmcstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 07:14:22 -0000 Author: obrien Date: Mon Jul 2 07:14:21 2012 New Revision: 237969 URL: http://svn.freebsd.org/changeset/base/237969 Log: MFC: r227524: improve the grep-ability output strings. Modified: stable/9/usr.sbin/pmccontrol/pmccontrol.c stable/9/usr.sbin/pmcstat/pmcpl_calltree.c stable/9/usr.sbin/pmcstat/pmcpl_gprof.c stable/9/usr.sbin/pmcstat/pmcstat.c stable/9/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/pmccontrol/ (props changed) stable/9/usr.sbin/pmcstat/ (props changed) Modified: stable/9/usr.sbin/pmccontrol/pmccontrol.c ============================================================================== --- stable/9/usr.sbin/pmccontrol/pmccontrol.c Mon Jul 2 07:11:43 2012 (r237968) +++ stable/9/usr.sbin/pmccontrol/pmccontrol.c Mon Jul 2 07:14:21 2012 (r237969) @@ -147,8 +147,9 @@ pmcc_do_enable_disable(struct pmcc_op_li npmc = 0; for (c = 0; c < ncpu; c++) { if ((t = pmc_npmc(c)) < 0) - err(EX_OSERR, "Unable to determine the number of " - "PMCs in CPU %d", c); + err(EX_OSERR, + "Unable to determine the number of PMCs in CPU %d", + c); npmc = t > npmc ? t : npmc; } @@ -211,8 +212,8 @@ pmcc_do_enable_disable(struct pmcc_op_li if (error < 0) err(EX_OSERR, "%s of PMC %d on CPU %d failed", - b == PMCC_OP_ENABLE ? "Enable" : - "Disable", j, i); + b == PMCC_OP_ENABLE ? "Enable" : "Disable", + j, i); } return error; @@ -308,8 +309,9 @@ pmcc_do_list_events(void) printf("%s\n", pmc_name_of_class(c)); if (pmc_event_names_of_class(c, &eventnamelist, &nevents) < 0) - err(EX_OSERR, "ERROR: Cannot find information for " - "event class \"%s\"", pmc_name_of_class(c)); + err(EX_OSERR, +"ERROR: Cannot find information for event class \"%s\"", + pmc_name_of_class(c)); for (j = 0; j < nevents; j++) printf("\t%s\n", eventnamelist[j]); @@ -481,7 +483,8 @@ main(int argc, char **argv) break; case PMCC_ENABLE_DISABLE: if (STAILQ_EMPTY(&head)) - errx(EX_USAGE, "No PMCs specified to enable or disable"); + errx(EX_USAGE, + "No PMCs specified to enable or disable"); error = pmcc_do_enable_disable(&head); break; default: Modified: stable/9/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcpl_calltree.c Mon Jul 2 07:11:43 2012 (r237968) +++ stable/9/usr.sbin/pmcstat/pmcpl_calltree.c Mon Jul 2 07:14:21 2012 (r237969) @@ -587,7 +587,8 @@ pmcpl_ct_topkeypress(int c, WINDOW *w) switch (c) { case 'f': pmcstat_skiplink = !pmcstat_skiplink; - wprintw(w, "skip empty link %s", pmcstat_skiplink ? "on" : "off"); + wprintw(w, "skip empty link %s", + pmcstat_skiplink ? "on" : "off"); break; } Modified: stable/9/usr.sbin/pmcstat/pmcpl_gprof.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcpl_gprof.c Mon Jul 2 07:11:43 2012 (r237968) +++ stable/9/usr.sbin/pmcstat/pmcpl_gprof.c Mon Jul 2 07:14:21 2012 (r237969) @@ -333,8 +333,9 @@ pmcpl_gmon_initimage(struct pmcstat_imag count = 0; do { if (++count > 999) - errx(EX_CANTCREAT, "ERROR: cannot create a " - "gmon file for \"%s\"", name); + errx(EX_CANTCREAT, + "ERROR: cannot create a gmon file for" + " \"%s\"", name); snprintf(name, sizeof(name), "%.*s~%3.3d.gmon", nlen, sn, count); if (pmcstat_string_lookup(name) == NULL) { @@ -516,8 +517,8 @@ pmcpl_gmon_shutdown(FILE *mf) pgf->pgf_pmcid), pgf->pgf_nsamples); if (pgf->pgf_overflow && args.pa_verbosity >= 1) - warnx("WARNING: profile \"%s\" " - "overflowed.", + warnx( +"WARNING: profile \"%s\" overflowed.", pmcstat_string_unintern( pgf->pgf_name)); } Modified: stable/9/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcstat.c Mon Jul 2 07:11:43 2012 (r237968) +++ stable/9/usr.sbin/pmcstat/pmcstat.c Mon Jul 2 07:14:21 2012 (r237969) @@ -156,8 +156,9 @@ pmcstat_get_cpumask(const char *cpuspec, do { cpu = strtol(s, &end, 0); if (cpu < 0 || end == s) - errx(EX_USAGE, "ERROR: Illegal CPU specification " - "\"%s\".", cpuspec); + errx(EX_USAGE, + "ERROR: Illegal CPU specification \"%s\".", + cpuspec); CPU_SET(cpu, cpumask); s = end + strspn(end, ", \t"); } while (*s); @@ -179,9 +180,9 @@ pmcstat_attach_pmcs(void) if (pmc_attach(ev->ev_pmcid, pt->pt_pid) == 0) count++; else if (errno != ESRCH) - err(EX_OSERR, "ERROR: cannot attach pmc " - "\"%s\" to process %d", ev->ev_name, - (int) pt->pt_pid); + err(EX_OSERR, +"ERROR: cannot attach pmc \"%s\" to process %d", + ev->ev_name, (int)pt->pt_pid); } if (count == 0) @@ -198,11 +199,11 @@ pmcstat_cleanup(void) STAILQ_FOREACH_SAFE(ev, &args.pa_events, ev_next, tmp) if (ev->ev_pmcid != PMC_ID_INVALID) { if (pmc_stop(ev->ev_pmcid) < 0) - err(EX_OSERR, "ERROR: cannot stop pmc 0x%x " - "\"%s\"", ev->ev_pmcid, ev->ev_name); + err(EX_OSERR, "ERROR: cannot stop pmc 0x%x \"%s\"", + ev->ev_pmcid, ev->ev_name); if (pmc_release(ev->ev_pmcid) < 0) - err(EX_OSERR, "ERROR: cannot release pmc " - "0x%x \"%s\"", ev->ev_pmcid, ev->ev_name); + err(EX_OSERR, "ERROR: cannot release pmc 0x%x \"%s\"", + ev->ev_pmcid, ev->ev_name); free(ev->ev_name); free(ev->ev_spec); STAILQ_REMOVE(&args.pa_events, ev, pmcstat_ev, ev_next); @@ -424,8 +425,8 @@ pmcstat_print_counters(void) continue; if (pmc_read(ev->ev_pmcid, &value) < 0) - err(EX_OSERR, "ERROR: Cannot read pmc " - "\"%s\"", ev->ev_name); + err(EX_OSERR, "ERROR: Cannot read pmc \"%s\"", + ev->ev_name); (void) fprintf(args.pa_printfile, "%*ju ", ev->ev_fieldwidth + extra_width, @@ -641,8 +642,9 @@ main(int argc, char **argv) err(EX_OSERR, "ERROR: Cannot stat \"%s\"", optarg); if (!S_ISDIR(sb.st_mode)) - errx(EX_USAGE, "ERROR: \"%s\" is not a " - "directory.", optarg); + errx(EX_USAGE, + "ERROR: \"%s\" is not a directory.", + optarg); args.pa_samplesdir = optarg; args.pa_flags |= FLAG_HAS_SAMPLESDIR; args.pa_required |= FLAG_DO_GPROF; @@ -801,15 +803,16 @@ main(int argc, char **argv) args.pa_printfile != stderr) (void) fclose(args.pa_printfile); if ((args.pa_printfile = fopen(optarg, "w")) == NULL) - errx(EX_OSERR, "ERROR: cannot open \"%s\" for " - "writing.", optarg); + errx(EX_OSERR, + "ERROR: cannot open \"%s\" for writing.", + optarg); args.pa_flags |= FLAG_DO_PRINT; break; case 'O': /* sampling output */ if (args.pa_outputpath) - errx(EX_USAGE, "ERROR: option -O may only be " - "specified once."); + errx(EX_USAGE, +"ERROR: option -O may only be specified once."); args.pa_outputpath = optarg; args.pa_flags |= FLAG_HAS_OUTPUT_LOGFILE; break; @@ -824,8 +827,8 @@ main(int argc, char **argv) case 'R': /* read an existing log file */ if (args.pa_inputpath != NULL) - errx(EX_USAGE, "ERROR: option -R may only be " - "specified once."); + errx(EX_USAGE, +"ERROR: option -R may only be specified once."); args.pa_inputpath = optarg; if (args.pa_printfile == stderr) args.pa_printfile = stdout; @@ -855,8 +858,9 @@ main(int argc, char **argv) case 'w': /* wait interval */ interval = strtod(optarg, &end); if (*end != '\0' || interval <= 0) - errx(EX_USAGE, "ERROR: Illegal wait interval " - "value \"%s\".", optarg); + errx(EX_USAGE, +"ERROR: Illegal wait interval value \"%s\".", + optarg); args.pa_flags |= FLAG_HAS_WAIT_INTERVAL; args.pa_interval = interval; break; @@ -870,8 +874,9 @@ main(int argc, char **argv) case 'z': graphdepth = strtod(optarg, &end); if (*end != '\0' || graphdepth <= 0) - errx(EX_USAGE, "ERROR: Illegal callchain " - "depth \"%s\".", optarg); + errx(EX_USAGE, + "ERROR: Illegal callchain depth \"%s\".", + optarg); args.pa_graphdepth = graphdepth; args.pa_required |= FLAG_DO_CALLGRAPHS; break; @@ -908,8 +913,8 @@ main(int argc, char **argv) /* disallow -O and -R together */ if (args.pa_outputpath && args.pa_inputpath) - errx(EX_USAGE, "ERROR: options -O and -R are mutually " - "exclusive."); + errx(EX_USAGE, + "ERROR: options -O and -R are mutually exclusive."); /* -m option is allowed with -R only. */ if (args.pa_flags & FLAG_DO_ANNOTATE && args.pa_inputpath == NULL) @@ -918,8 +923,8 @@ main(int argc, char **argv) /* -m option is not allowed combined with -g or -G. */ if (args.pa_flags & FLAG_DO_ANNOTATE && args.pa_flags & (FLAG_DO_GPROF | FLAG_DO_CALLGRAPHS)) - errx(EX_USAGE, "ERROR: option -m and -g | -G are mutually " - "exclusive"); + errx(EX_USAGE, + "ERROR: option -m and -g | -G are mutually exclusive"); if (args.pa_flags & FLAG_READ_LOGFILE) { errmsg = NULL; @@ -930,8 +935,9 @@ main(int argc, char **argv) else if (!STAILQ_EMPTY(&args.pa_events)) errmsg = "a PMC event specification"; if (errmsg) - errx(EX_USAGE, "ERROR: option -R may not be used with " - "%s.", errmsg); + errx(EX_USAGE, + "ERROR: option -R may not be used with %s.", + errmsg); } else if (STAILQ_EMPTY(&args.pa_events)) /* All other uses require a PMC spec. */ pmcstat_show_usage(); @@ -939,58 +945,66 @@ main(int argc, char **argv) /* check for -t pid without a process PMC spec */ if ((args.pa_required & FLAG_HAS_TARGET) && (args.pa_flags & FLAG_HAS_PROCESS_PMCS) == 0) - errx(EX_USAGE, "ERROR: option -t requires a process mode PMC " - "to be specified."); + errx(EX_USAGE, +"ERROR: option -t requires a process mode PMC to be specified." + ); /* check for process-mode options without a command or -t pid */ if ((args.pa_required & FLAG_HAS_PROCESS_PMCS) && (args.pa_flags & (FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET)) == 0) - errx(EX_USAGE, "ERROR: options -d, -E, -p, -P, and -W require " - "a command line or target process."); + errx(EX_USAGE, +"ERROR: options -d, -E, -p, -P, and -W require a command line or target process." + ); /* check for -p | -P without a target process of some sort */ if ((args.pa_required & (FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET)) && (args.pa_flags & (FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET)) == 0) - errx(EX_USAGE, "ERROR: options -P and -p require a " - "target process or a command line."); + errx(EX_USAGE, +"ERROR: options -P and -p require a target process or a command line." + ); /* check for process-mode options without a process-mode PMC */ if ((args.pa_required & FLAG_HAS_PROCESS_PMCS) && (args.pa_flags & FLAG_HAS_PROCESS_PMCS) == 0) - errx(EX_USAGE, "ERROR: options -d, -E, and -W require a " - "process mode PMC to be specified."); + errx(EX_USAGE, +"ERROR: options -d, -E, and -W require a process mode PMC to be specified." + ); /* check for -c cpu with no system mode PMCs or logfile. */ if ((args.pa_required & FLAG_HAS_SYSTEM_PMCS) && (args.pa_flags & FLAG_HAS_SYSTEM_PMCS) == 0 && (args.pa_flags & FLAG_READ_LOGFILE) == 0) - errx(EX_USAGE, "ERROR: option -c requires at least one " - "system mode PMC to be specified."); + errx(EX_USAGE, +"ERROR: option -c requires at least one system mode PMC to be specified." + ); /* check for counting mode options without a counting PMC */ if ((args.pa_required & FLAG_HAS_COUNTING_PMCS) && (args.pa_flags & FLAG_HAS_COUNTING_PMCS) == 0) - errx(EX_USAGE, "ERROR: options -C, -W and -o require at " - "least one counting mode PMC to be specified."); + errx(EX_USAGE, +"ERROR: options -C, -W and -o require at least one counting mode PMC to be specified." + ); /* check for sampling mode options without a sampling PMC spec */ if ((args.pa_required & FLAG_HAS_SAMPLING_PMCS) && (args.pa_flags & FLAG_HAS_SAMPLING_PMCS) == 0) - errx(EX_USAGE, "ERROR: options -N, -n and -O require at " - "least one sampling mode PMC to be specified."); + errx(EX_USAGE, +"ERROR: options -N, -n and -O require at least one sampling mode PMC to be specified." + ); /* check if -g/-G/-m/-T are being used correctly */ if ((args.pa_flags & FLAG_DO_ANALYSIS) && !(args.pa_flags & (FLAG_HAS_SAMPLING_PMCS|FLAG_READ_LOGFILE))) - errx(EX_USAGE, "ERROR: options -g/-G/-m/-T require sampling PMCs " - "or -R to be specified."); + errx(EX_USAGE, +"ERROR: options -g/-G/-m/-T require sampling PMCs or -R to be specified." + ); /* check if -O was spuriously specified */ if ((args.pa_flags & FLAG_HAS_OUTPUT_LOGFILE) && (args.pa_required & FLAG_HAS_OUTPUT_LOGFILE) == 0) errx(EX_USAGE, - "ERROR: option -O is used only with options " - "-E, -P, -S and -W."); +"ERROR: option -O is used only with options -E, -P, -S and -W." + ); /* -k kernel path require -g/-G/-m/-T or -R */ if ((args.pa_flags & FLAG_HAS_KERNELPATH) && @@ -1017,8 +1031,9 @@ main(int argc, char **argv) if ((args.pa_flags & FLAG_HAS_COUNTING_PMCS) && (args.pa_flags & FLAG_HAS_SAMPLING_PMCS) && ((args.pa_flags & FLAG_HAS_OUTPUT_LOGFILE) == 0)) - errx(EX_USAGE, "ERROR: option -O is required if counting and " - "sampling PMCs are specified together."); + errx(EX_USAGE, +"ERROR: option -O is required if counting and sampling PMCs are specified together." + ); /* * Check if "-k kerneldir" was specified, and if whether @@ -1044,8 +1059,9 @@ main(int argc, char **argv) err(EX_OSERR, "ERROR: Cannot stat \"%s\"", buffer); if (!S_ISDIR(sb.st_mode)) - errx(EX_USAGE, "ERROR: \"%s\" is not a " - "directory.", buffer); + errx(EX_USAGE, + "ERROR: \"%s\" is not a directory.", + buffer); } } @@ -1058,8 +1074,9 @@ main(int argc, char **argv) else { args.pa_graphfile = fopen(graphfilename, "w"); if (args.pa_graphfile == NULL) - err(EX_OSERR, "ERROR: cannot open \"%s\" " - "for writing", graphfilename); + err(EX_OSERR, + "ERROR: cannot open \"%s\" for writing", + graphfilename); } } if (args.pa_flags & FLAG_DO_ANNOTATE) { @@ -1073,11 +1090,13 @@ main(int argc, char **argv) if ((args.pa_flags & FLAG_READ_LOGFILE) == 0) { if (pmc_init() < 0) err(EX_UNAVAILABLE, - "ERROR: Initialization of the pmc(3) library failed"); + "ERROR: Initialization of the pmc(3) library failed" + ); if ((npmc = pmc_npmc(0)) < 0) /* assume all CPUs are identical */ - err(EX_OSERR, "ERROR: Cannot determine the number of PMCs " - "on CPU %d", 0); + err(EX_OSERR, +"ERROR: Cannot determine the number of PMCs on CPU %d", + 0); } /* Allocate a kqueue */ @@ -1152,17 +1171,18 @@ main(int argc, char **argv) */ STAILQ_FOREACH(ev, &args.pa_events, ev_next) { - if (pmc_allocate(ev->ev_spec, ev->ev_mode, + if (pmc_allocate(ev->ev_spec, ev->ev_mode, ev->ev_flags, ev->ev_cpu, &ev->ev_pmcid) < 0) - err(EX_OSERR, "ERROR: Cannot allocate %s-mode pmc with " - "specification \"%s\"", - PMC_IS_SYSTEM_MODE(ev->ev_mode) ? "system" : "process", - ev->ev_spec); - - if (PMC_IS_SAMPLING_MODE(ev->ev_mode) && - pmc_set(ev->ev_pmcid, ev->ev_count) < 0) - err(EX_OSERR, "ERROR: Cannot set sampling count " - "for PMC \"%s\"", ev->ev_name); + err(EX_OSERR, +"ERROR: Cannot allocate %s-mode pmc with specification \"%s\"", + PMC_IS_SYSTEM_MODE(ev->ev_mode) ? + "system" : "process", ev->ev_spec); + + if (PMC_IS_SAMPLING_MODE(ev->ev_mode) && + pmc_set(ev->ev_pmcid, ev->ev_count) < 0) + err(EX_OSERR, + "ERROR: Cannot set sampling count for PMC \"%s\"", + ev->ev_name); } /* compute printout widths */ @@ -1204,8 +1224,8 @@ main(int argc, char **argv) EV_SET(&kev, SIGWINCH, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); if (kevent(pmcstat_kq, &kev, 1, NULL, 0, NULL) < 0) - err(EX_OSERR, "ERROR: Cannot register kevent for " - "SIGWINCH"); + err(EX_OSERR, + "ERROR: Cannot register kevent for SIGWINCH"); args.pa_toptty = 1; } @@ -1248,8 +1268,8 @@ main(int argc, char **argv) args.pa_interval * 1000, NULL); if (kevent(pmcstat_kq, &kev, 1, NULL, 0, NULL) < 0) - err(EX_OSERR, "ERROR: Cannot register kevent for " - "timer"); + err(EX_OSERR, + "ERROR: Cannot register kevent for timer"); } /* attach PMCs to the target process, starting it if specified */ @@ -1262,8 +1282,8 @@ main(int argc, char **argv) /* Attach process pmcs to the target process. */ if (args.pa_flags & (FLAG_HAS_TARGET | FLAG_HAS_COMMANDLINE)) { if (SLIST_EMPTY(&args.pa_targets)) - errx(EX_DATAERR, "ERROR: No matching target " - "processes."); + errx(EX_DATAERR, + "ERROR: No matching target processes."); if (args.pa_flags & FLAG_HAS_PROCESS_PMCS) pmcstat_attach_pmcs(); @@ -1319,7 +1339,8 @@ main(int argc, char **argv) keypad(stdscr, TRUE); clear(); /* Get terminal width / height with ncurses. */ - getmaxyx(stdscr, pmcstat_displayheight, pmcstat_displaywidth); + getmaxyx(stdscr, + pmcstat_displayheight, pmcstat_displaywidth); pmcstat_displayheight--; pmcstat_displaywidth--; atexit(pmcstat_topexit); } @@ -1385,8 +1406,8 @@ main(int argc, char **argv) } else if (kev.ident == SIGWINCH) { if (ioctl(fileno(args.pa_printfile), TIOCGWINSZ, &ws) < 0) - err(EX_OSERR, "ERROR: Cannot determine " - "window size"); + err(EX_OSERR, + "ERROR: Cannot determine window size"); pmcstat_displayheight = ws.ws_row - 1; pmcstat_displaywidth = ws.ws_col - 1; } else @@ -1406,7 +1427,8 @@ main(int argc, char **argv) if (do_print && !do_read) { if ((args.pa_required & FLAG_HAS_OUTPUT_LOGFILE) == 0) { pmcstat_print_pmcs(); - if (runstate == PMCSTAT_FINISHED && /* final newline */ + if (runstate == PMCSTAT_FINISHED && + /* final newline */ (args.pa_flags & FLAG_DO_PRINT) == 0) (void) fprintf(args.pa_printfile, "\n"); } @@ -1433,19 +1455,19 @@ main(int argc, char **argv) /* check if the driver lost any samples or events */ if (check_driver_stats) { if (pmc_get_driver_stats(&ds_end) < 0) - err(EX_OSERR, "ERROR: Cannot retrieve driver " - "statistics"); + err(EX_OSERR, + "ERROR: Cannot retrieve driver statistics"); if (ds_start.pm_intr_bufferfull != ds_end.pm_intr_bufferfull && args.pa_verbosity > 0) - warnx("WARNING: some samples were dropped. Please " - "consider tuning the \"kern.hwpmc.nsamples\" " - "tunable."); + warnx("WARNING: some samples were dropped.\n" +"Please consider tuning the \"kern.hwpmc.nsamples\" tunable." + ); if (ds_start.pm_buffer_requests_failed != ds_end.pm_buffer_requests_failed && args.pa_verbosity > 0) - warnx("WARNING: some events were discarded. Please " - "consider tuning the \"kern.hwpmc.nbuffers\" " - "tunable."); + warnx("WARNING: some events were discarded.\n" +"Please consider tuning the \"kern.hwpmc.nbuffers\" tunable." + ); } exit(EX_OK); Modified: stable/9/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcstat_log.c Mon Jul 2 07:11:43 2012 (r237968) +++ stable/9/usr.sbin/pmcstat/pmcstat_log.c Mon Jul 2 07:14:21 2012 (r237969) @@ -421,8 +421,8 @@ pmcstat_image_get_aout_params(struct pmc assert(path != NULL); if (image->pi_iskernelmodule) - errx(EX_SOFTWARE, "ERROR: a.out kernel modules are " - "unsupported \"%s\"", path); + errx(EX_SOFTWARE, + "ERROR: a.out kernel modules are unsupported \"%s\"", path); (void) snprintf(buffer, sizeof(buffer), "%s%s", args.pa_fsroot, path); @@ -656,8 +656,9 @@ pmcstat_image_get_elf_params(struct pmcs } if (gelf_getehdr(e, &eh) != &eh) { - warnx("WARNING: Cannot retrieve the ELF Header for " - "\"%s\": %s.", buffer, elf_errmsg(-1)); + warnx( + "WARNING: Cannot retrieve the ELF Header for \"%s\": %s.", + buffer, elf_errmsg(-1)); goto done; } @@ -678,16 +679,17 @@ pmcstat_image_get_elf_params(struct pmcs */ if (eh.e_type == ET_EXEC) { if (elf_getphnum(e, &nph) == 0) { - warnx("WARNING: Could not determine the number of " - "program headers in \"%s\": %s.", buffer, + warnx( +"WARNING: Could not determine the number of program headers in \"%s\": %s.", + buffer, elf_errmsg(-1)); goto done; } for (i = 0; i < eh.e_phnum; i++) { if (gelf_getphdr(e, i, &ph) != &ph) { - warnx("WARNING: Retrieval of PHDR entry #%ju " - "in \"%s\" failed: %s.", (uintmax_t) i, - buffer, elf_errmsg(-1)); + warnx( +"WARNING: Retrieval of PHDR entry #%ju in \"%s\" failed: %s.", + (uintmax_t) i, buffer, elf_errmsg(-1)); goto done; } switch (ph.p_type) { @@ -696,8 +698,8 @@ pmcstat_image_get_elf_params(struct pmcs break; case PT_INTERP: if ((elfbase = elf_rawfile(e, NULL)) == NULL) { - warnx("WARNING: Cannot retrieve the " - "interpreter for \"%s\": %s.", + warnx( +"WARNING: Cannot retrieve the interpreter for \"%s\": %s.", buffer, elf_errmsg(-1)); goto done; } @@ -717,17 +719,18 @@ pmcstat_image_get_elf_params(struct pmcs * Get the min and max VA associated with this ELF object. */ if (elf_getshnum(e, &nsh) == 0) { - warnx("WARNING: Could not determine the number of sections " - "for \"%s\": %s.", buffer, elf_errmsg(-1)); + warnx( +"WARNING: Could not determine the number of sections for \"%s\": %s.", + buffer, elf_errmsg(-1)); goto done; } for (i = 0; i < nsh; i++) { if ((scn = elf_getscn(e, i)) == NULL || gelf_getshdr(scn, &sh) != &sh) { - warnx("WARNING: Could not retrieve section header " - "#%ju in \"%s\": %s.", (uintmax_t) i, buffer, - elf_errmsg(-1)); + warnx( +"WARNING: Could not retrieve section header #%ju in \"%s\": %s.", + (uintmax_t) i, buffer, elf_errmsg(-1)); goto done; } if (sh.sh_flags & SHF_EXECINSTR) { @@ -923,8 +926,8 @@ pmcstat_image_unmap(struct pmcstat_proce * the new one at [end]. */ if ((pcmnew = malloc(sizeof(*pcmnew))) == NULL) - err(EX_OSERR, "ERROR: Cannot split a map " - "entry"); + err(EX_OSERR, + "ERROR: Cannot split a map entry"); pcmnew->ppm_image = pcm->ppm_image; @@ -981,8 +984,9 @@ pmcstat_image_addr2line(struct pmcstat_i if (image->pi_addr2line == NULL) { if (!addr2line_warn) { addr2line_warn = 1; - warnx("WARNING: addr2line is needed" - "for source code information."); + warnx( +"WARNING: addr2line is needed for source code information." + ); } return (0); } @@ -1300,8 +1304,9 @@ pmcstat_process_exec(struct pmcstat_proc break; default: - err(EX_SOFTWARE, "ERROR: Unsupported executable type for " - "\"%s\"", pmcstat_string_unintern(path)); + err(EX_SOFTWARE, + "ERROR: Unsupported executable type for \"%s\"", + pmcstat_string_unintern(path)); } } @@ -1355,10 +1360,9 @@ pmcstat_analyze_log(void) case PMCLOG_TYPE_INITIALIZE: if ((ev.pl_u.pl_i.pl_version & 0xFF000000) != PMC_VERSION_MAJOR << 24 && args.pa_verbosity > 0) - warnx("WARNING: Log version 0x%x does not " - "match compiled version 0x%x.", - ev.pl_u.pl_i.pl_version, - PMC_VERSION_MAJOR); + warnx( +"WARNING: Log version 0x%x does not match compiled version 0x%x.", + ev.pl_u.pl_i.pl_version, PMC_VERSION_MAJOR); break; case PMCLOG_TYPE_MAP_IN: @@ -1582,8 +1586,9 @@ pmcstat_analyze_log(void) else if (ev.pl_state == PMCLOG_REQUIRE_DATA) return (PMCSTAT_RUNNING); - err(EX_DATAERR, "ERROR: event parsing failed (record %jd, " - "offset 0x%jx)", (uintmax_t) ev.pl_count + 1, ev.pl_offset); + err(EX_DATAERR, + "ERROR: event parsing failed (record %jd, offset 0x%jx)", + (uintmax_t) ev.pl_count + 1, ev.pl_offset); } /* @@ -1623,9 +1628,9 @@ pmcstat_print_log(void) pmc_name_of_cputype(ev.pl_u.pl_i.pl_arch)); if ((ev.pl_u.pl_i.pl_version & 0xFF000000) != PMC_VERSION_MAJOR << 24 && args.pa_verbosity > 0) - warnx("WARNING: Log version 0x%x != expected " - "version 0x%x.", ev.pl_u.pl_i.pl_version, - PMC_VERSION); + warnx( +"WARNING: Log version 0x%x != expected version 0x%x.", + ev.pl_u.pl_i.pl_version, PMC_VERSION); break; case PMCLOG_TYPE_MAP_IN: PMCSTAT_PRINT_ENTRY("map-in","%d %p \"%s\"", @@ -1712,8 +1717,8 @@ pmcstat_print_log(void) else if (ev.pl_state == PMCLOG_REQUIRE_DATA) return (PMCSTAT_RUNNING); - errx(EX_DATAERR, "ERROR: event parsing failed " - "(record %jd, offset 0x%jx).", + errx(EX_DATAERR, + "ERROR: event parsing failed (record %jd, offset 0x%jx).", (uintmax_t) ev.pl_count + 1, ev.pl_offset); /*NOTREACHED*/ }