Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/pmcstat/pmcstat.c
Show First 20 Lines • Show All 505 Lines • ▼ Show 20 Lines | main(int argc, char **argv) | ||||
* which is usually all CPUs in the system. | * which is usually all CPUs in the system. | ||||
*/ | */ | ||||
if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, | if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, | ||||
sizeof(rootmask), &rootmask) == -1) | sizeof(rootmask), &rootmask) == -1) | ||||
err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); | err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); | ||||
CPU_COPY(&rootmask, &cpumask); | CPU_COPY(&rootmask, &cpumask); | ||||
while ((option = getopt(argc, argv, | while ((option = getopt(argc, argv, | ||||
"CD:EF:G:ILM:NO:P:R:S:TUWZa:c:def:gi:k:l:m:n:o:p:qr:s:t:u:vw:z:")) != -1) | "ACD:EF:G:ILM:NO:P:R:S:TUWZa:c:def:gi:k:l:m:n:o:p:qr:s:t:u:vw:z:")) != -1) | ||||
switch (option) { | switch (option) { | ||||
case 'A': | |||||
args.pa_flags |= FLAG_SKIP_TOP_FN_RES; | |||||
break; | |||||
case 'a': /* Annotate + callgraph */ | case 'a': /* Annotate + callgraph */ | ||||
args.pa_flags |= FLAG_DO_ANNOTATE; | args.pa_flags |= FLAG_DO_ANNOTATE; | ||||
args.pa_plugin = PMCSTAT_PL_ANNOTATE_CG; | args.pa_plugin = PMCSTAT_PL_ANNOTATE_CG; | ||||
graphfilename = optarg; | graphfilename = optarg; | ||||
break; | break; | ||||
case 'C': /* cumulative values */ | case 'C': /* cumulative values */ | ||||
use_cumulative_counts = !use_cumulative_counts; | use_cumulative_counts = !use_cumulative_counts; | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | case 'G': /* produce a system-wide callgraph */ | ||||
break; | break; | ||||
case 'g': /* produce gprof compatible profiles */ | case 'g': /* produce gprof compatible profiles */ | ||||
args.pa_flags |= FLAG_DO_GPROF; | args.pa_flags |= FLAG_DO_GPROF; | ||||
args.pa_pplugin = PMCSTAT_PL_CALLGRAPH; | args.pa_pplugin = PMCSTAT_PL_CALLGRAPH; | ||||
args.pa_plugin = PMCSTAT_PL_GPROF; | args.pa_plugin = PMCSTAT_PL_GPROF; | ||||
break; | break; | ||||
case 'I': | |||||
args.pa_flags |= FLAG_SKIP_TOP_FN_RES; | |||||
break; | |||||
case 'i': | case 'i': | ||||
args.pa_flags |= FLAG_FILTER_THREAD_ID; | args.pa_flags |= FLAG_FILTER_THREAD_ID; | ||||
args.pa_tid = strtol(optarg, &end, 0); | args.pa_tid = strtol(optarg, &end, 0); | ||||
break; | |||||
case 'I': | |||||
args.pa_flags |= FLAG_SHOW_OFFSET; | |||||
break; | break; | ||||
case 'k': /* pathname to the kernel */ | case 'k': /* pathname to the kernel */ | ||||
free(args.pa_kernel); | free(args.pa_kernel); | ||||
args.pa_kernel = strdup(optarg); | args.pa_kernel = strdup(optarg); | ||||
if (args.pa_kernel == NULL) | if (args.pa_kernel == NULL) | ||||
errx(EX_SOFTWARE, "ERROR: Out of memory"); | errx(EX_SOFTWARE, "ERROR: Out of memory"); | ||||
args.pa_required |= FLAG_DO_ANALYSIS; | args.pa_required |= FLAG_DO_ANALYSIS; | ||||
▲ Show 20 Lines • Show All 859 Lines • Show Last 20 Lines |