# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1161254373 -32400 # Node ID f52b302e20074729ada0eaa67319bf136d7f95ca # Parent 04dd19d5bf7fb9908508807ed2438a455d291837 xenperfmon support PATCHNAME: xenperfmon_support Signed-off-by: Isaku Yamahata diff -r 04dd19d5bf7f -r f52b302e2007 daemon/opd_perfmon.c --- a/daemon/opd_perfmon.c Thu Oct 19 19:26:45 2006 +0900 +++ b/daemon/opd_perfmon.c Thu Oct 19 19:39:33 2006 +0900 @@ -381,6 +381,7 @@ static void wait_for_child(struct child close(child->up_pipe[1]); } +static struct child* xen_ctx; void perfmon_init(void) { @@ -389,6 +390,24 @@ void perfmon_init(void) if (cpu_type == CPU_TIMER_INT) return; + + if (!no_xen) { + xen_ctx = xmalloc(sizeof(struct child)); + xen_ctx->pid = getpid(); + xen_ctx->up_pipe[0] = -1; + xen_ctx->up_pipe[1] = -1; + xen_ctx->sigusr1 = 0; + xen_ctx->sigusr2 = 0; + xen_ctx->sigterm = 0; + + create_context(xen_ctx); + + write_pmu(xen_ctx); + + load_context(xen_ctx); + return; + } + nr = sysconf(_SC_NPROCESSORS_ONLN); if (nr == -1) { @@ -432,6 +451,9 @@ void perfmon_exit(void) if (cpu_type == CPU_TIMER_INT) return; + if (!no_xen) + return; + for (i = 0; i < nr_cpus; ++i) { kill(children[i].pid, SIGKILL); waitpid(children[i].pid, NULL, 0); @@ -446,6 +468,13 @@ void perfmon_start(void) if (cpu_type == CPU_TIMER_INT) return; + if (!no_xen) { + printf("PFM_START on xen\n"); + fflush(stdout); + perfmon_start_child(xen_ctx->ctx_fd); + return; + } + for (i = 0; i < nr_cpus; ++i) kill(children[i].pid, SIGUSR1); } @@ -458,6 +487,13 @@ void perfmon_stop(void) if (cpu_type == CPU_TIMER_INT) return; + if (!no_xen) { + printf("PFM_STOP on Xen\n"); + fflush(stdout); + perfmon_stop_child(xen_ctx->ctx_fd); + return; + } + for (i = 0; i < nr_cpus; ++i) kill(children[i].pid, SIGUSR2); }