234 case 1:
235 opts->mseconds = (uint_t)(strtod(argv[optind], &endp) * 1000.0);
236 if (*endp != '\0') {
237 (void) fprintf(stderr,
238 gettext("%s: invalid argument \"%s\"\n"),
239 opts->pgmname, argv[optind]);
240 errcnt++;
241 }
242 break;
243 default:
244 errcnt++;
245 break;
246 }
247
248 if (opts->nsamples == 0 || opts->mseconds == 0)
249 errcnt++;
250
251 if (errcnt != 0 || opts->dohelp ||
252 (opts->nsets = cpc_setgrp_numsets(opts->master)) == 0) {
253 (void) fprintf(opts->dohelp ? stdout : stderr, gettext(
254 "Usage:\n\t%s [-c events] [-p period] [-nstD] "
255 "[-T d|u] [interval [count]]\n\n"
256 "\t-c events specify processor events to be monitored\n"
257 "\t-n\t suppress titles\n"
258 "\t-p period cycle through event list periodically\n"
259 "\t-s\t run user soaker thread for system-only events\n"
260 "\t-t\t include %s register\n"
261 "\t-T d|u\t Display a timestamp in date (d) or unix "
262 "time_t (u)\n"
263 "\t-D\t enable debug mode\n"
264 "\t-h\t print extended usage information\n\n"
265 "\tUse cputrack(1) to monitor per-process statistics.\n"),
266 opts->pgmname, CPC_TICKREG_NAME);
267 if (opts->dohelp) {
268 (void) putchar('\n');
269 (void) capabilities(cpc, stdout);
270 exit(0);
271 }
272 exit(2);
273 }
274
275 /*
276 * If the user requested periodic behavior, calculate the rest time
277 * between cycles.
278 */
279 if (opts->doperiod) {
280 opts->mseconds_rest = (uint_t)((period * 1000.0) -
281 (opts->mseconds * opts->nsets));
282 if ((int)opts->mseconds_rest < 0)
283 opts->mseconds_rest = 0;
284 if (opts->nsamples != UINT_MAX)
285 opts->nsamples *= opts->nsets;
286 }
|
234 case 1:
235 opts->mseconds = (uint_t)(strtod(argv[optind], &endp) * 1000.0);
236 if (*endp != '\0') {
237 (void) fprintf(stderr,
238 gettext("%s: invalid argument \"%s\"\n"),
239 opts->pgmname, argv[optind]);
240 errcnt++;
241 }
242 break;
243 default:
244 errcnt++;
245 break;
246 }
247
248 if (opts->nsamples == 0 || opts->mseconds == 0)
249 errcnt++;
250
251 if (errcnt != 0 || opts->dohelp ||
252 (opts->nsets = cpc_setgrp_numsets(opts->master)) == 0) {
253 (void) fprintf(opts->dohelp ? stdout : stderr, gettext(
254 "Usage:\n\t%s -c events [-c events]... [-p period] [-nstD] "
255 "[-T d|u] [interval [count]]\n\t%s -h\n\n"
256 "\t-c events specify processor events to be monitored\n"
257 "\t-n\t suppress titles\n"
258 "\t-p period cycle through event list periodically\n"
259 "\t-s\t run user soaker thread for system-only events\n"
260 "\t-t\t include %s register\n"
261 "\t-T d|u\t Display a timestamp in date (d) or unix "
262 "time_t (u)\n"
263 "\t-D\t enable debug mode\n"
264 "\t-h\t print extended usage information\n\n"
265 "\tUse cputrack(1) to monitor per-process statistics.\n"),
266 opts->pgmname, opts->pgmname, CPC_TICKREG_NAME);
267 if (opts->dohelp) {
268 (void) putchar('\n');
269 (void) capabilities(cpc, stdout);
270 exit(0);
271 }
272 exit(2);
273 }
274
275 /*
276 * If the user requested periodic behavior, calculate the rest time
277 * between cycles.
278 */
279 if (opts->doperiod) {
280 opts->mseconds_rest = (uint_t)((period * 1000.0) -
281 (opts->mseconds * opts->nsets));
282 if ((int)opts->mseconds_rest < 0)
283 opts->mseconds_rest = 0;
284 if (opts->nsamples != UINT_MAX)
285 opts->nsamples *= opts->nsets;
286 }
|