|
[oprof-cvs] CVS: oprofile/daemon init.c,1.9,1.10 opd_interface.h,1.4,1.5 opd_kernel.c,1.44,1.45 opd_kernel.h,1.9,1.10 opd_trans.c,1.13,1.14 oprofiled.c,1.80,1.81 oprofiled.h,1.6,1.7
From: John Levon <movement@us...> - 2006-01-16 13:21
|
Update of /cvsroot/oprofile/oprofile/daemon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24227/daemon
Modified Files:
init.c opd_interface.h opd_kernel.c opd_kernel.h opd_trans.c
oprofiled.c oprofiled.h
Log Message:
Xen support from HP.
Index: init.c
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/init.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -d -r1.9 -r1.10
--- init.c 2 May 2005 15:06:57 -0000 1.9
+++ init.c 16 Jan 2006 13:21:08 -0000 1.10
@@ -7,6 +7,9 @@
*
* @author John Levon
* @author Philippe Elie
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
*/
#include "config.h"
@@ -222,6 +225,7 @@ static void opd_26_init(void)
size_t opd_buf_size;
opd_create_vmlinux(vmlinux, kernel_range);
+ opd_create_xen(xenimage, xen_range);
opd_buf_size = opd_read_fs_int("/dev/oprofile/", "buffer_size", 1);
kernel_pointer_size = opd_read_fs_int("/dev/oprofile/", "pointer_size", 1);
Index: opd_interface.h
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/opd_interface.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -d -r1.4 -r1.5
--- opd_interface.h 14 Apr 2005 02:14:17 -0000 1.4
+++ opd_interface.h 16 Jan 2006 13:21:09 -0000 1.5
@@ -8,6 +8,9 @@
*
* @author John Levon
* @author Philippe Elie
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
*/
#ifndef OPD_INTERFACE_H
@@ -17,10 +20,13 @@
#define CPU_SWITCH_CODE 2
#define COOKIE_SWITCH_CODE 3
#define KERNEL_ENTER_SWITCH_CODE 4
-#define KERNEL_EXIT_SWITCH_CODE 5
-#define MODULE_LOADED_CODE 6
+#define USER_ENTER_SWITCH_CODE 5
+#define MODULE_LOADED_CODE 6
#define CTX_TGID_CODE 7
#define TRACE_BEGIN_CODE 8
-#define LAST_CODE 9
+/* Code 9 used to be TRACE_END_CODE which is not used anymore */
+/* Code 9 is now considered an unknown escape code */
+#define XEN_ENTER_SWITCH_CODE 10
+#define LAST_CODE 11
#endif /* OPD_INTERFACE_H */
Index: opd_kernel.c
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/opd_kernel.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -p -d -r1.44 -r1.45
--- opd_kernel.c 9 Aug 2005 12:49:06 -0000 1.44
+++ opd_kernel.c 16 Jan 2006 13:21:09 -0000 1.45
@@ -7,6 +7,9 @@
*
* @author John Levon
* @author Philippe Elie
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
*/
#include "opd_kernel.h"
@@ -29,6 +32,8 @@ static LIST_HEAD(modules);
static struct kernel_image vmlinux_image;
+static struct kernel_image xen_image;
+
void opd_create_vmlinux(char const * name, char const * arg)
{
/* vmlinux is *not* on the list of modules */
@@ -54,6 +59,31 @@ void opd_create_vmlinux(char const * nam
}
}
+void opd_create_xen(char const * name, char const * arg)
+{
+ /* xen is *not* on the list of modules */
+ list_init(&xen_image.list);
+
+ /* for no xen */
+ if (no_xen) {
+ xen_image.name = "no-xen";
+ return;
+ }
+
+ xen_image.name = xstrdup(name);
+
+ sscanf(arg, "%llx,%llx", &xen_image.start, &xen_image.end);
+
+ verbprintf(vmisc, "xen_start = %llx, xen_end = %llx\n",
+ xen_image.start, xen_image.end);
+
+ if (!xen_image.start && !xen_image.end) {
+ fprintf(stderr, "error: mis-parsed xen range: %llx-%llx\n",
+ xen_image.start, xen_image.end);
+ exit(EXIT_FAILURE);
+ }
+}
+
/**
* Allocate and initialise a kernel image description
@@ -192,5 +222,8 @@ struct kernel_image * find_kernel_image(
return image;
}
+ if (xen_image.start <= trans->pc && xen_image.end > trans->pc)
+ return &xen_image;
+
return NULL;
}
Index: opd_kernel.h
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/opd_kernel.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -d -r1.9 -r1.10
--- opd_kernel.h 24 Sep 2003 21:21:14 -0000 1.9
+++ opd_kernel.h 16 Jan 2006 13:21:09 -0000 1.10
@@ -7,6 +7,9 @@
*
* @author John Levon
* @author Philippe Elie
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
*/
#ifndef OPD_KERNEL_H
@@ -20,6 +23,8 @@ struct transient;
/** create the kernel image */
void opd_create_vmlinux(char const * name, char const * arg);
+void opd_create_xen(char const * name, char const * arg);
+
/** opd_reread_module_info - parse /proc/modules for kernel modules */
void opd_reread_module_info(void);
Index: opd_trans.c
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/opd_trans.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -d -r1.13 -r1.14
--- opd_trans.c 24 Aug 2005 17:30:32 -0000 1.13
+++ opd_trans.c 16 Jan 2006 13:21:09 -0000 1.14
@@ -7,6 +7,9 @@
*
* @author John Levon
* @author Philippe Elie
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
*/
#include "opd_trans.h"
@@ -219,9 +222,9 @@ static void code_kernel_enter(struct tra
}
-static void code_kernel_exit(struct transient * trans)
+static void code_user_enter(struct transient * trans)
{
- verbprintf(vmisc, "KERNEL_EXIT_SWITCH to user-space\n");
+ verbprintf(vmisc, "USER_ENTER_SWITCH to user-space\n");
trans->in_kernel = 0;
clear_trans_current(trans);
clear_trans_last(trans);
@@ -248,6 +251,19 @@ static void code_trace_begin(struct tran
trans->tracing = TRACING_START;
}
+static void code_xen_enter(struct transient *trans)
+{
+ verbprintf(vmisc, "XEN_ENTER_SWITCH to xen\n");
+ trans->in_kernel = 1;
+ trans->current = NULL;
+ /* subtlety: we must keep trans->cookie cached, even though it's
+ * meaningless for Xen - we won't necessarily get a cookie switch
+ * on Xen exit. See comments in opd_sfile.c. It seems that we can
+ * get away with in_kernel = 1 as long as we supply the correct
+ * Xen image, and its address range in startup find_kernel_image
+ * is modified to look in the Xen image also
+ */
+}
typedef void (*handler_t)(struct transient *);
@@ -257,11 +273,13 @@ static handler_t handlers[LAST_CODE + 1]
&code_cpu_switch,
&code_cookie_switch,
&code_kernel_enter,
- &code_kernel_exit,
+ &code_user_enter,
&code_module_loaded,
/* tgid handled differently */
&code_unknown,
&code_trace_begin,
+ &code_unknown,
+ &code_xen_enter,
};
Index: oprofiled.c
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/oprofiled.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -p -d -r1.80 -r1.81
--- oprofiled.c 7 Aug 2005 11:15:29 -0000 1.80
+++ oprofiled.c 16 Jan 2006 13:21:09 -0000 1.81
@@ -7,6 +7,9 @@
*
* @author John Levon
* @author Philippe Elie
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
*/
#include "config.h"
@@ -60,6 +63,9 @@ int separate_cpu;
int no_vmlinux;
char * vmlinux;
char * kernel_range;
+int no_xen;
+char * xenimage;
+char * xen_range;
static char * verbose;
static char * binary_name_filter;
static char * events;
@@ -75,6 +81,8 @@ static struct poptOption options[] = {
{ "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, },
+ { "xen-range", 0, POPT_ARG_STRING, &xen_range, 0, "Xen VMA range", "start-end", },
+ { "xen-image", 0, POPT_ARG_STRING, &xenimage, 0, "Xen image", "file", },
{ "image", 0, POPT_ARG_STRING, &binary_name_filter, 0, "image name filter", "profile these comma separated image" },
{ "separate-lib", 0, POPT_ARG_INT, &separate_lib, 0, "separate library samples for each distinct application", "[0|1]", },
{ "separate-kernel", 0, POPT_ARG_INT, &separate_kernel, 0, "separate kernel samples for each distinct application", "[0|1]", },
@@ -405,7 +413,26 @@ static void opd_options(int argc, char c
poptPrintHelp(optcon, stderr, 0);
exit(EXIT_FAILURE);
}
-
+
+ if (!xenimage || !strcmp("", xenimage)) {
+ no_xen = 1;
+ } else {
+ no_xen = 0;
+
+ /* canonicalise xen image filename. */
+ tmp = xmalloc(PATH_MAX);
+ if (realpath(xenimage, tmp))
+ xenimage = tmp;
+ else
+ free(tmp);
+
+ if (!xen_range || !strcmp("", xen_range)) {
+ fprintf(stderr, "oprofiled: no Xen VMA range specified.\n");
+ poptPrintHelp(optcon, stderr, 0);
+ exit(EXIT_FAILURE);
+ }
+ }
+
opd_parse_events(events);
opd_parse_image_filter();
Index: oprofiled.h
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/oprofiled.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -d -r1.6 -r1.7
--- oprofiled.h 26 Apr 2005 23:49:45 -0000 1.6
+++ oprofiled.h 16 Jan 2006 13:21:09 -0000 1.7
@@ -7,6 +7,9 @@
*
* @author John Levon
* @author Philippe Elie
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
*/
#ifndef OPROFILED_H
@@ -58,5 +61,8 @@ extern int separate_cpu;
extern int no_vmlinux;
extern char * vmlinux;
extern char * kernel_range;
+extern int no_xen;
+extern char * xenimage;
+extern char * xen_range;
#endif /* OPROFILED_H */
|
| Thread | Author | Date |
|---|---|---|
| [oprof-cvs] CVS: oprofile/daemon init.c,1.9,1.10 opd_interface.h,1.4,1.5 opd_kernel.c,1.44,1.45 opd_kernel.h,1.9,1.10 opd_trans.c,1.13,1.14 oprofiled.c,1.80,1.81 oprofiled.h,1.6,1.7 | John Levon <movement@us...> |