From: Philippe E. <ph...@us...> - 2003-04-14 20:47:47
|
Update of /cvsroot/oprofile/oprofile/dae In directory sc8-pr-cvs1:/tmp/cvs-serv28171 Modified Files: opd_kernel.c opd_proc.c oprofiled.c Log Message: handle --no-vmlinux for 2.4 regards, Phil Index: opd_kernel.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/dae/opd_kernel.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- opd_kernel.c 2 Mar 2003 03:52:07 -0000 1.30 +++ opd_kernel.c 14 Apr 2003 20:47:38 -0000 1.31 @@ -35,6 +35,7 @@ extern char * vmlinux; extern int verbose; +extern int no_vmlinux; extern unsigned long opd_stats[]; static struct opd_image * kernel_image; @@ -50,6 +51,9 @@ */ void opd_init_kernel_image(void) { + /* for no vmlinux */ + if (!vmlinux) + vmlinux = "/no-vmlinux"; kernel_image = opd_get_kernel_image(vmlinux, NULL); } @@ -392,7 +396,7 @@ */ void opd_handle_kernel_sample(unsigned long eip, u32 counter) { - if (eip < kernel_end) { + if (no_vmlinux || eip < kernel_end) { opd_stats[OPD_KERNEL]++; opd_put_image_sample(kernel_image, eip - kernel_start, counter); return; @@ -411,7 +415,8 @@ */ int opd_eip_is_kernel(unsigned long eip) { - return (eip >= kernel_start); + /* kernel_start == 0 when vm_nolinux != 0 */ + return kernel_start && eip >= kernel_start; } /** Index: opd_proc.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/dae/opd_proc.c,v retrieving revision 1.143 retrieving revision 1.144 diff -u -d -r1.143 -r1.144 --- opd_proc.c 31 Mar 2003 16:39:44 -0000 1.143 +++ opd_proc.c 14 Apr 2003 20:47:40 -0000 1.144 @@ -33,6 +33,7 @@ extern op_cpu cpu_type; extern int separate_lib_samples; extern int separate_kernel_samples; +extern int no_vmlinux; /* hash of process lists */ static struct opd_proc * opd_procs[OPD_MAX_PROC_HASH]; @@ -377,7 +378,7 @@ return; if (!(proc = opd_get_proc(sample->pid))) { - if (in_kernel_eip) { + if (in_kernel_eip || no_vmlinux) { /* idle task get a 0 pid and is hidden we can never get * a proc so on we fall back to put sample in vmlinux * or module samples files. Here we will catch also @@ -397,11 +398,18 @@ } if (in_kernel_eip) { - /* assert: separate_kernel_samples is true */ + /* assert: separate_kernel_samples || no_vmlinux == 0 */ opd_add_kernel_map(proc, sample->eip); if (opd_lookup_maps(proc, sample)) { return; } + } + + if (no_vmlinux) { + /* in_kernel_eip can't be true when no_vmlinux != 0, we handle + * now all unknown samples and they go blindly to no-vmlinux */ + opd_handle_kernel_sample(sample->eip, sample->counter); + return; } /* couldn't locate it */ Index: oprofiled.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/dae/oprofiled.c,v retrieving revision 1.115 retrieving revision 1.116 diff -u -d -r1.115 -r1.116 --- oprofiled.c 5 Apr 2003 18:26:10 -0000 1.115 +++ oprofiled.c 14 Apr 2003 20:47:43 -0000 1.116 @@ -62,6 +62,7 @@ op_cpu cpu_type; int separate_lib_samples; int separate_kernel_samples; +int no_vmlinux; char * vmlinux; int kernel_only; unsigned long opd_stats[OPD_MAX_STATS] = { 0, }; @@ -87,6 +88,7 @@ { "pgrp-filter", 0, POPT_ARG_INT, &pgrp_filter, 0, "only profile the given process tty group", "pgrp" }, { "kernel-range", 'r', POPT_ARG_STRING, &kernel_range, 0, "Kernel VMA range", "start-end", }, { "vmlinux", 'k', POPT_ARG_STRING, &vmlinux, 0, "vmlinux kernel image", "file", }, + { "no-vmlinux", 0, POPT_ARG_NONE, &no_vmlinux, 0, "vmlinux kernel image file not available", NULL, }, { "separate-lib-samples", 0, POPT_ARG_INT, &separate_lib_samples, 0, "separate library samples for each distinct application", "[0|1]", }, { "separate-kernel-samples", 0, POPT_ARG_INT, &separate_kernel_samples, 0, "separate kernel samples for each distinct application, this option imply --separate-lib-samples=1", "[0|1]", }, { "version", 'v', POPT_ARG_NONE, &showvers, 0, "show version", NULL, }, @@ -411,19 +413,23 @@ cpu_type = op_get_cpu_type(); op_nr_counters = op_get_nr_counters(cpu_type); - if (!vmlinux || !strcmp("", vmlinux)) { - fprintf(stderr, "oprofiled: no vmlinux specified.\n"); - poptPrintHelp(optcon, stderr, 0); - exit(EXIT_FAILURE); - } + if (!no_vmlinux) { + if (!no_vmlinux && (!vmlinux || !strcmp("", vmlinux))) { + fprintf(stderr, "oprofiled: no vmlinux specified.\n"); + poptPrintHelp(optcon, stderr, 0); + exit(EXIT_FAILURE); + } - /* canonicalise vmlinux filename. fix #637805 */ - vmlinux = op_relative_to_absolute_path(vmlinux, NULL); + /* canonicalise vmlinux filename. fix #637805 */ + vmlinux = op_relative_to_absolute_path(vmlinux, NULL); - if (!kernel_range || !strcmp("", kernel_range)) { - fprintf(stderr, "oprofiled: no kernel VMA range specified.\n"); - poptPrintHelp(optcon, stderr, 0); - exit(EXIT_FAILURE); + if (!kernel_range || !strcmp("", kernel_range)) { + fprintf(stderr, "oprofiled: no kernel VMA range specified.\n"); + poptPrintHelp(optcon, stderr, 0); + exit(EXIT_FAILURE); + } + + opd_parse_kernel_range(kernel_range); } opd_buf_size = opd_read_fs_int("bufsize"); @@ -438,7 +444,6 @@ cpu_speed = op_cpu_frequency(); - opd_parse_kernel_range(kernel_range); poptFreeContext(optcon); } |