From: Philippe E. <ph...@us...> - 2004-01-18 02:21:17
|
Update of /cvsroot/oprofile/oprofile/libop In directory sc8-pr-cvs1:/tmp/cvs-serv25275/libop Modified Files: op_config.h op_mangle.c op_mangle.h op_sample_file.h Log Message: merge BRANCH_CALLGRAPH to HEAD Index: op_config.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libop/op_config.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -p -d -r1.17 -r1.18 --- op_config.h 16 Jan 2004 17:48:54 -0000 1.17 +++ op_config.h 18 Jan 2004 02:21:14 -0000 1.18 @@ -28,6 +28,6 @@ #endif #define OPD_MAGIC "DAE\n" -#define OPD_VERSION 0x9 +#define OPD_VERSION 0x10 #endif /* OP_CONFIG_H */ Index: op_mangle.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libop/op_mangle.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -d -r1.8 -r1.9 --- op_mangle.c 29 May 2003 01:10:07 -0000 1.8 +++ op_mangle.c 18 Jan 2004 02:21:14 -0000 1.9 @@ -19,51 +19,53 @@ #include "op_sample_file.h" #include "op_config.h" +static void append_separator(char * dest, int flags, char const * image_name) +{ + if ((flags & MANGLE_KERNEL) && !strchr(image_name, '/')) { + strcat(dest, "{kern}" "/"); + } else { + strcat(dest, "{root}" "/"); + } +} + char * op_mangle_filename(struct mangle_values const * values) { char * mangled; size_t len; - char const * image_name = values->image_name; - char const * dep_name = values->dep_name; + /* if dep_name != image_name we need to revert them (and so revert them + * unconditionnaly because if they are equal it doesn't hurt to invert + * them), see P:3, FIXME: this is a bit weirds, we prolly need to + * reword pp_interface */ + char const * image_name = values->dep_name; + char const * dep_name = values->image_name; len = strlen(OP_SAMPLES_CURRENT_DIR) + strlen(values->image_name) - + 1 + strlen(values->event_name) + 1; - - if (values->flags & MANGLE_DEP_NAME) { - len += strlen(values->dep_name) + 1; + + 1 + strlen(values->event_name) + + 1 + strlen(values->dep_name) + 1; - /* PP:3 image_name and dep_name are reversed when - * profiling with --separate */ - image_name = values->dep_name; - dep_name = values->image_name; - } + if (values->flags & MANGLE_CALLGRAPH) + len += strlen(values->cg_image_name) + 1; - /* provision for tgid, tid, unit_mask, cpu and three {root}, {dep} or - * {kern} marker */ - len += 128; /* FIXME: too ugly */ + /* provision for tgid, tid, unit_mask, cpu and some {root}, {dep}, + * {kern} and {cg} marker */ + len += 256; /* FIXME: too ugly */ mangled = xmalloc(len); strcpy(mangled, OP_SAMPLES_CURRENT_DIR); - - if ((values->flags & MANGLE_KERNEL) && !strchr(image_name, '/')) { - strcat(mangled, "{kern}" "/"); - } else { - strcat(mangled, "{root}" "/"); - } - + append_separator(mangled, values->flags, image_name); strcat(mangled, image_name); strcat(mangled, "/"); - if (values->flags & MANGLE_DEP_NAME) { - strcat(mangled, "{dep}" "/"); - if ((values->flags & MANGLE_KERNEL) - && !strchr(image_name, '/')) { - strcat(mangled, "{kern}" "/"); - } else { - strcat(mangled, "{root}" "/"); - } - strcat(mangled, dep_name); + strcat(mangled, "{dep}" "/"); + append_separator(mangled, values->flags, image_name); + strcat(mangled, dep_name); + strcat(mangled, "/"); + + if (values->flags & MANGLE_CALLGRAPH) { + strcat(mangled, "{cg}" "/"); + append_separator(mangled, values->flags, values->cg_image_name); + strcat(mangled, values->cg_image_name); strcat(mangled, "/"); } Index: op_mangle.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libop/op_mangle.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -d -r1.6 -r1.7 --- op_mangle.h 29 May 2003 01:10:08 -0000 1.6 +++ op_mangle.h 18 Jan 2004 02:21:14 -0000 1.7 @@ -19,12 +19,12 @@ extern "C" { #endif enum mangle_flags { - MANGLE_NONE = 0, - MANGLE_DEP_NAME = (1 << 0), - MANGLE_CPU = (1 << 1), - MANGLE_TGID = (1 << 2), - MANGLE_TID = (1 << 3), - MANGLE_KERNEL = (1 << 4) + MANGLE_NONE = 0, + MANGLE_CPU = (1 << 0), + MANGLE_TGID = (1 << 1), + MANGLE_TID = (1 << 2), + MANGLE_KERNEL = (1 << 3), + MANGLE_CALLGRAPH = (1 << 4) }; /** @@ -37,6 +37,7 @@ struct mangle_values { char const * image_name; char const * dep_name; + char const * cg_image_name; char const * event_name; int count; unsigned int unit_mask; Index: op_sample_file.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libop/op_sample_file.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- op_sample_file.h 20 Oct 2003 01:42:35 -0000 1.9 +++ op_sample_file.h 18 Jan 2004 02:21:14 -0000 1.10 @@ -24,11 +24,13 @@ struct opd_header { u32 ctr_event; u32 ctr_um; u32 ctr_count; + // for cg file the from_cg_is_kernel u32 is_kernel; double cpu_speed; time_t mtime; + u32 cg_to_is_kernel; /* binary compatibility reserve */ - u32 reserved1[6]; + u32 reserved1[5]; }; #endif /* OP_SAMPLE_FILE_H */ |