diff options
Diffstat (limited to 'meta/recipes-kernel/oprofile')
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofile/acinclude.m4 | 600 | ||||
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofile/opstart.patch | 235 | ||||
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofile/xml_callgraph_details.patch | 232 | ||||
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofile_0.9.6.bb | 31 | ||||
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofile_cvs.bb | 27 | ||||
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofileui-svn.inc | 8 | ||||
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofileui.inc | 22 | ||||
-rw-r--r-- | meta/recipes-kernel/oprofile/oprofileui_svn.bb | 2 |
8 files changed, 1157 insertions, 0 deletions
diff --git a/meta/recipes-kernel/oprofile/oprofile/acinclude.m4 b/meta/recipes-kernel/oprofile/oprofile/acinclude.m4 new file mode 100644 index 00000000000..ffaa8288df9 --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofile/acinclude.m4 @@ -0,0 +1,600 @@ +dnl AX_KERNEL_OPTION(option, action-if-found, action-if-not-found) +dnl see if autoconf.h defines the option +AC_DEFUN([AX_KERNEL_OPTION], [ +SAVE_CFLAGS=$CFLAGS +CFLAGS="-I$KINC -O2 -D__KERNEL__" +AC_TRY_COMPILE( [#include <linux/config.h>], +[ +#ifndef $1 +break_me_hard(\\\); +#endif +],[$2],[$3],) +CFLAGS=$SAVE_CFLAGS +]) + +dnl Handle the 2.4 module inside module/ +AC_DEFUN([AX_CONFIG_MODULE], +[ +if test ! -f $KINC/linux/autoconf.h; then + AC_MSG_ERROR([no suitably configured kernel include tree found]) +fi + +dnl --- Get Linux kernel version and compile parameters --- + +AC_SUBST(KVERS) +AC_MSG_CHECKING([for kernel version]) +dnl it's like this to handle mandrake's fubar version.h - bug #471448 +eval KVERS=`gcc -I$KINC -E -dM $KINC/linux/version.h | grep -w UTS_RELEASE | awk '{print $[]3}'` +AC_MSG_RESULT([$KVERS]) +case "$KVERS" in +2.2.*|2.4.*) ;; +*) AC_MSG_ERROR([Unsupported kernel version]) +esac + +dnl Check for the minimal kernel version supported +AC_MSG_CHECKING([kernel version]) +AX_KERNEL_VERSION(2, 2, 10, <=, AC_MSG_RESULT([ok]), AC_MSG_ERROR([check html documentation install section])) + +dnl linux/spinlock.h added at some point in past +AC_MSG_CHECKING([for $KINC/linux/spinlock.h]) +if test -f $KINC/linux/spinlock.h; then + EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DHAVE_LINUX_SPINLOCK_HEADER" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +AC_MSG_CHECKING([for rtc_lock]) +gcc -I$KINC -E $KINC/linux/mc146818rtc.h | grep rtc_lock >/dev/null +if test "$?" -eq 0; then + EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DRTC_LOCK" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +arch="unknown" +AC_MSG_CHECKING(for x86-64 architecture) +AX_KERNEL_OPTION(CONFIG_X86_64, x8664=1, x8664=0) +AX_MSG_RESULT_YN($x8664) +BUILD_HAMMER=no +if test "$x8664" -eq 1; then + arch="x86" + BUILD_HAMMER=yes +else + AC_MSG_CHECKING(for x86 architecture) + AX_KERNEL_OPTION(CONFIG_X86, x86=1, x86=0) + AX_KERNEL_OPTION(CONFIG_X86_WP_WORKS_OK, x86=1, x86=$x86) + AX_MSG_RESULT_YN($x86) + test "$x86" = 1 && arch="x86" + + if test "$arch" = "unknown"; then + AC_MSG_CHECKING(for ia64 architecture) + AX_KERNEL_OPTION(CONFIG_IA64, ia64=1, ia64=0) + AX_MSG_RESULT_YN($ia64) + test "$ia64" = 1 && arch="ia64" + fi + +fi +AC_SUBST(BUILD_HAMMER) + +test "$arch" = "unknown" && AC_MSG_ERROR(Unsupported architecture) + +dnl check to see if kernel verion appropriate for arch +AC_MSG_CHECKING(arch/kernel version combination) +case "$arch" in +ia64) + AX_KERNEL_VERSION(2, 4, 18, <, AC_MSG_RESULT([ok]), + AC_MSG_ERROR([unsupported arch/kernel])) ;; +*) AC_MSG_RESULT([ok]) +esac + +dnl for now we do not support PREEMPT patch +AC_MSG_CHECKING([for preempt patch]) +AX_KERNEL_OPTION(CONFIG_PREEMPT,preempt=1,preempt=0) +AX_MSG_RESULT_YN([$preempt]) +test "$preempt" = 0 || AC_MSG_ERROR([unsupported kernel configuration : CONFIG_PREEMPT]) + +AC_SUBST(KINC) + +MODINSTALLDIR=/lib/modules/$KVERS + +OPROFILE_MODULE_ARCH=$arch +AC_SUBST(OPROFILE_MODULE_ARCH) +] +) + +dnl AX_KERNEL_VERSION(major, minor, level, comparison, action-if-true, action-if-false) +AC_DEFUN([AX_KERNEL_VERSION], [ +SAVE_CFLAGS=$CFLAGS +CFLAGS="-I$KINC -D__KERNEL__ -Werror" +AC_TRY_COMPILE( + [ + #include <linux/version.h> + #include <linux/config.h> + ], + [ + #if LINUX_VERSION_CODE $4 KERNEL_VERSION($1, $2, $3) + break_me_hard(\\\); + #endif + ], +[$5],[$6],) +CFLAGS=$SAVE_CFLAGS +]) + + +dnl AX_MSG_RESULT_YN(a) +dnl results "yes" iff a==1, "no" else +AC_DEFUN([AX_MSG_RESULT_YN], [x=no +test "x$1" = "x1" && x=yes +AC_MSG_RESULT($x)]) + +dnl AX_MALLOC_ATTRIBUTE - see if gcc will take __attribute__((malloc)) +AC_DEFUN([AX_MALLOC_ATTRIBUTE], +[ +AC_MSG_CHECKING([whether malloc attribute is understood]) +SAVE_CFLAGS=$CFLAGS +CFLAGS="-Werror $CFLAGS" +AC_TRY_COMPILE(,[ +void monkey() __attribute__((malloc)); +],AC_MSG_RESULT([yes]); AC_DEFINE(MALLOC_ATTRIBUTE_OK, 1, [whether malloc attribute is understood]), AC_MSG_RESULT([no])) +CFLAGS=$SAVE_CFLAGS +] +) + +dnl builtin_expect is used in module we can't add that in config.h +AC_DEFUN([AX_BUILTIN_EXPECT], +[ +AC_MSG_CHECKING([whether __builtin_expect is understood]) +SAVE_CFLAGS=$CFLAGS +CFLAGS="-Werror $CFLAGS" +AC_TRY_LINK(,[ +int i; +if (__builtin_expect(i, 0)) { } +], +AC_MSG_RESULT([yes]); EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DEXPECT_OK", +AC_MSG_RESULT([no]);) +CFLAGS=$SAVE_CFLAGS +] +) + +dnl AX_EXTRA_DIRS - Let user specify extra dirs for include/libs +AC_DEFUN([AX_EXTRA_DIRS], +[ +AC_ARG_WITH(extra-includes, +[ --with-extra-includes=DIR add extra include paths], + use_extra_includes="$withval", + use_extra_includes=NO +) +if test -n "$use_extra_includes" && \ + test "$use_extra_includes" != "NO"; then + ac_save_ifs=$IFS + IFS=':' + for dir in $use_extra_includes; do + extra_includes="$extra_includes -I$dir" + done + IFS=$ac_save_ifs + CPPFLAGS="$CPPFLAGS $extra_includes" +fi + +AC_ARG_WITH(extra-libs, +[ --with-extra-libs=DIR add extra library paths], + use_extra_libs=$withval, + use_extra_libs=NO +) +if test -n "$use_extra_libs" && \ + test "$use_extra_libs" != "NO"; then + ac_save_ifs=$IFS + IFS=':' + for dir in $use_extra_libs; do + extra_libraries="$extra_libraries -L$dir" + done + IFS=$ac_save_ifs + LDFLAGS="$LDFLAGS $extra_libraries" +fi +] +) + +dnl AX_POPT_CONST - check popt prototype +AC_DEFUN([AX_POPT_CONST], +[ +AC_MSG_CHECKING([popt prototype]) +SAVE_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-Werror $CXXFLAGS" +AC_TRY_COMPILE([#include <popt.h>], +[ +int c; char **v; +poptGetContext(0, c, v, 0, 0); +], +AC_MSG_RESULT([takes char **]);, +AC_MSG_RESULT([takes const char **]); AC_DEFINE(CONST_POPT, 1, [whether popt prototype takes a const char **])) +CXXFLAGS="$SAVE_CXXFLAGS" +] +) + +dnl AX_CHECK_SSTREAM - check if local sstream is needed to compile OK +AC_DEFUN([AX_CHECK_SSTREAM], +[ +AC_MSG_CHECKING([whether to use included sstream]) +AC_TRY_COMPILE([#include <sstream>], [], +AC_MSG_RESULT([no]);, +AC_MSG_RESULT([yes]); OP_CXXFLAGS="$OP_CXXFLAGS -I\${top_srcdir}/include") +] +) + +dnl AX_CHECK_TYPEDEF(typedef_name, type, action-if-true, action-if-false) +dnl exec action-if-true if typedef_name is a typedef to type else exec +dnl action-if-false +dnl currently work only with type typedef'ed in stddef.h +AC_DEFUN([AX_CHECK_TYPEDEF], [ +dnl AC_LANG_PUSH(C) not in autoconf 2.13 +AC_LANG_SAVE +AC_LANG_C +SAVE_CFLAGS=$CFLAGS +CFLAGS="-Werror $CFLAGS" + +AC_TRY_COMPILE( + [ + #include <stddef.h> + ], + [ + typedef void (*fct1)($1); + typedef void (*fct2)($2); + fct1 f1 = 0; + fct2 f2 = 0; + if (f1 == f2) {} + ], +[$3],[$4]) + +CFLAGS=$SAVE_CFLAGS +AC_LANG_RESTORE +]) + + +dnl AX_TYPEDEFED_NAME(typedef_name, candidate_list, var_name) +dnl set var_name to the typedef name of $1 which must be in canditate_list +dnl else produce a fatal error +AC_DEFUN([AX_TYPEDEFED_NAME], [ + AC_MSG_CHECKING([type of $1]) + for f in $2; do + AX_CHECK_TYPEDEF($1, $f, $3="$f", $3="") + if test -n "${$3}"; then + break + fi + done + if test -n "${$3}"; then + AC_MSG_RESULT([${$3}]) + else + AC_MSG_ERROR([not found]) + fi +]) + +dnl find a binary in the path +AC_DEFUN([QT_FIND_PATH], +[ + AC_MSG_CHECKING([for $1]) + AC_CACHE_VAL(qt_cv_path_$1, + [ + qt_cv_path_$1="NONE" + if test -n "$$2"; then + qt_cv_path_$1="$$2"; + else + dirs="$3" + qt_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$qt_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5"; then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + qt_cv_path_$1="$dir/$1" + break + fi + else + qt_cv_path_$1="$dir/$1" + break + fi + fi + done + fi + ]) + + if test -z "$qt_cv_path_$1" || test "$qt_cv_path_$1" = "NONE"; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($qt_cv_path_$1) + $2=$qt_cv_path_$1 + fi +]) + +dnl Find the uic compiler on the path or in qt_cv_dir +AC_DEFUN([QT_FIND_UIC], +[ + QT_FIND_PATH(uic, ac_uic, $qt_cv_dir/bin) + if test -z "$ac_uic" -a "$FATAL" = 1; then + AC_MSG_ERROR([uic binary not found in \$PATH or $qt_cv_dir/bin !]) + fi +]) + +dnl Find the right moc in path/qt_cv_dir +AC_DEFUN([QT_FIND_MOC], +[ + QT_FIND_PATH(moc2, ac_moc2, $qt_cv_dir/bin) + QT_FIND_PATH(moc, ac_moc1, $qt_cv_dir/bin) + + if test -n "$ac_moc1" -a -n "$ac_moc2"; then + dnl found both. Prefer Qt3's if it exists else moc2 + $ac_moc1 -v 2>&1 | grep "Qt 3" >/dev/null + if test "$?" = 0; then + ac_moc=$ac_moc1; + else + ac_moc=$ac_moc2; + fi + else + if test -n "$ac_moc1"; then + ac_moc=$ac_moc1; + else + ac_moc=$ac_moc2; + fi + fi + + if test -z "$ac_moc" -a "$FATAL" = 1; then + AC_MSG_ERROR([moc binary not found in \$PATH or $qt_cv_dir/bin !]) + fi +]) + +dnl check a particular libname +AC_DEFUN([QT_TRY_LINK], +[ + SAVE_LIBS="$LIBS" + LIBS="$LIBS $1" + AC_TRY_LINK([ + #include <qglobal.h> + #include <qstring.h> + ], + [ + QString s("mangle_failure"); + #if (QT_VERSION < 221) + break_me_(\\\); + #endif + ], + qt_cv_libname=$1, + ) + LIBS="$SAVE_LIBS" +]) + +dnl check we can do a compile +AC_DEFUN([QT_CHECK_COMPILE], +[ + AC_MSG_CHECKING([for Qt library name]) + + AC_CACHE_VAL(qt_cv_libname, + [ + AC_LANG_CPLUSPLUS + SAVE_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS" + + for libname in -lqt-mt -lqt3 -lqt2 -lqt; + do + QT_TRY_LINK($libname) + if test -n "$qt_cv_libname"; then + break; + fi + done + + CXXFLAGS=$SAVE_CXXFLAGS + ]) + + if test -z "$qt_cv_libname"; then + AC_MSG_RESULT([failed]) + if test "$FATAL" = 1 ; then + AC_MSG_ERROR([Cannot compile a simple Qt executable. Check you have the right \$QTDIR !]) + fi + else + AC_MSG_RESULT([$qt_cv_libname]) + fi +]) + +dnl get Qt version we're using +AC_DEFUN([QT_GET_VERSION], +[ + AC_CACHE_CHECK([Qt version],lyx_cv_qtversion, + [ + AC_LANG_CPLUSPLUS + SAVE_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $QT_INCLUDES" + + cat > conftest.$ac_ext <<EOF +#line __oline__ "configure" +#include "confdefs.h" +#include <qglobal.h> +"%%%"QT_VERSION_STR"%%%" +EOF + lyx_cv_qtversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \ + grep '^"%%%"' 2>/dev/null | \ + sed -e 's/"%%%"//g' -e 's/"//g'` + rm -f conftest.$ac_ext + CPPFLAGS=$SAVE_CPPFLAGS + ]) + + QT_VERSION=$lyx_cv_qtversion + AC_SUBST(QT_VERSION) +]) + +dnl start here +AC_DEFUN([QT_DO_IT_ALL], +[ + dnl Please leave this alone. I use this file in + dnl oprofile. + FATAL=0 + + AC_ARG_WITH(qt-dir, [ --with-qt-dir where the root of Qt is installed ], + [ qt_cv_dir=`eval echo "$withval"/` ]) + + AC_ARG_WITH(qt-includes, [ --with-qt-includes where the Qt includes are. ], + [ qt_cv_includes=`eval echo "$withval"` ]) + + AC_ARG_WITH(qt-libraries, [ --with-qt-libraries where the Qt library is installed.], + [ qt_cv_libraries=`eval echo "$withval"` ]) + + dnl pay attention to $QTDIR unless overridden + if test -z "$qt_cv_dir"; then + qt_cv_dir=$QTDIR + fi + + dnl derive inc/lib if needed + if test -n "$qt_cv_dir"; then + if test -z "$qt_cv_includes"; then + qt_cv_includes=$qt_cv_dir/include + fi + if test -z "$qt_cv_libraries"; then + qt_cv_libraries=$qt_cv_dir/lib + fi + fi + + dnl flags for compilation + QT_INCLUDES= + QT_LDFLAGS= + if test -n "$qt_cv_includes"; then + QT_INCLUDES="-I$qt_cv_includes" + fi + if test -n "$qt_cv_libraries"; then + QT_LDFLAGS="-L$qt_cv_libraries" + fi + AC_SUBST(QT_INCLUDES) + AC_SUBST(QT_LDFLAGS) + + QT_FIND_MOC + MOC=$ac_moc + AC_SUBST(MOC) + QT_FIND_UIC + UIC=$ac_uic + AC_SUBST(UIC) + + QT_CHECK_COMPILE + + QT_LIB=$qt_cv_libname; + AC_SUBST(QT_LIB) + + if test -n "$qt_cv_libname"; then + QT_GET_VERSION + fi +]) + +dnl AX_CXXFLAGS_OPTIONS(var-name, option) +dnl add option to var-name if $CXX support it. +AC_DEFUN([AX_CHECK_PRECOMPILED_HEADER], [ +AC_MSG_CHECKING([whether ${CXX} support precompiled header]) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +SAVE_CXXFLAGS=$CXXFLAGS +dnl we consider than if -Winvalid-pch is accepted pch will works ... +CXXFLAGS=-Winvalid-pch +dnl but we don't want -Winvalid-pch else compilation will fail due -Werror and +dnl the fact than some pch will be invalid for the given compilation option +AC_TRY_COMPILE(,[;],AC_MSG_RESULT([yes]); $1="${$1} -include bits/stdc++.h", AC_MSG_RESULT([no])) +CXXFLAGS=$SAVE_CXXFLAGS +AC_LANG_RESTORE +]) + +dnl AX_CHECK_DOCBOOK +AC_DEFUN([AX_CHECK_DOCBOOK], [ +# It's just rude to go over the net to build +XSLTPROC_FLAGS=--nonet +DOCBOOK_ROOT= +if test ! -f /etc/xml/catalog; then + for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/; + do + if test -d "$i"; then + DOCBOOK_ROOT=$i + fi + done + + # Last resort - try net + if test -z "$DOCBOOK_ROOT"; then + XSLTPROC_FLAGS= + fi +else + XML_CATALOG=/etc/xml/catalog + CAT_ENTRY_START='<!--' + CAT_ENTRY_END='-->' +fi + +AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,) +XSLTPROC_WORKS=no +if test -n "$XSLTPROC"; then + AC_MSG_CHECKING([whether xsltproc works]) + + if test -n "$XML_CATALOG"; then + DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl" + else + DB_FILE="$DOCBOOK_ROOT/docbook.xsl" + fi + + $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END +<?xml version="1.0" encoding='ISO-8859-1'?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<book id="test"> +</book> +END + if test "$?" = 0; then + XSLTPROC_WORKS=yes + fi + AC_MSG_RESULT($XSLTPROC_WORKS) +fi +AM_CONDITIONAL(have_xsltproc, test "$XSLTPROC_WORKS" = "yes") + +AC_SUBST(XML_CATALOG) +AC_SUBST(XSLTPROC_FLAGS) +AC_SUBST(DOCBOOK_ROOT) +AC_SUBST(CAT_ENTRY_START) +AC_SUBST(CAT_ENTRY_END) +]) + +dnl AX_CFLAGS_OPTIONS(var-name, option) +dnl add option to var-name if $CC support it. +AC_DEFUN([AX_CFLAGS_OPTION], [ +AC_MSG_CHECKING([whether ${CC} $2 is understood]) +AC_LANG_SAVE +AC_LANG_C +SAVE_CFLAGS=$CFLAGS +CFLAGS=$2 +AC_TRY_COMPILE(,[;],AC_MSG_RESULT([yes]); $1="${$1} $2",AC_MSG_RESULT([no])) +CFLAGS=$SAVE_CFLAGS +AC_LANG_RESTORE +]) + + +dnl AX_CXXFLAGS_OPTIONS(var-name, option) +dnl add option to var-name if $CXX support it. +AC_DEFUN([AX_CXXFLAGS_OPTION], [ +AC_MSG_CHECKING([whether ${CXX} $2 is understood]) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +SAVE_CXXFLAGS=$CXXFLAGS +CXXFLAGS=$2 +AC_TRY_COMPILE(,[;],AC_MSG_RESULT([yes]); $1="${$1} $2",AC_MSG_RESULT([no])) +CXXFLAGS=$SAVE_CXXFLAGS +AC_LANG_RESTORE +]) + +dnl AX_COPY_IF_CHANGE(source, dest) +dnl copy source to dest if they don't compare equally or if dest doesn't exist +AC_DEFUN([AX_COPY_IF_CHANGE], [ +if test -r $2; then + if cmp $1 $2 > /dev/null; then + echo $2 is unchanged + else + cp -f $1 $2 + fi +else + cp -f $1 $2 +fi +]) + diff --git a/meta/recipes-kernel/oprofile/oprofile/opstart.patch b/meta/recipes-kernel/oprofile/oprofile/opstart.patch new file mode 100644 index 00000000000..d61c30095fe --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofile/opstart.patch @@ -0,0 +1,235 @@ +Index: oprofile/utils/Makefile.am +=================================================================== +--- oprofile.orig/utils/Makefile.am 2005-03-31 18:20:41.000000000 +0100 ++++ oprofile/utils/Makefile.am 2008-07-02 15:14:07.000000000 +0100 +@@ -3,8 +3,15 @@ + + LIBS=@POPT_LIBS@ @LIBERTY_LIBS@ + +-bin_PROGRAMS = ophelp ++bin_PROGRAMS = ophelp opstart + dist_bin_SCRIPTS = opcontrol + + ophelp_SOURCES = ophelp.c + ophelp_LDADD = ../libop/libop.a ../libutil/libutil.a ++ ++opstart_SOURCES = opstart.c ++ ++install-exec-local: ++ cd $(DESTDIR)/$(bindir) && \ ++ rm -f opstop && \ ++ $(LN_S) opstart opstop +Index: oprofile/utils/opstart.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/utils/opstart.c 2008-07-02 15:14:07.000000000 +0100 +@@ -0,0 +1,110 @@ ++/** ++ * @file opstart.c ++ * Start/Stop oprofile ++ * ++ * @remark Copyright 2007 Openedhand Ltd. ++ * @remark Read the file COPYING ++ * ++ * @author Richard Purdie ++ */ ++ ++#include <signal.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <unistd.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++ ++int main(const int argc, const char* argv[]) ++{ ++ const char *enable = "/dev/oprofile/enable"; ++ const char *lockfile; ++ unsigned long dpid; ++ struct stat sbuf; ++ FILE *lfile, *efile; ++ int sig, enb, err; ++ ++ if (argc >= 2) { ++ printf("Error: Invalid options.\n"); ++ return 1; ++ } ++ ++ lockfile = getenv("LOCK_FILE"); ++ if (!lockfile) ++ lockfile = "/var/lib/oprofile/lock"; ++ ++ /* Add SESSION_DIR support? */ ++ ++ if (geteuid()) { ++ printf("Error: This program must be run as root.\n"); ++ return 1; ++ } ++ ++ if (stat(enable, &sbuf)) { ++ printf("Error: Could not find /dev/oprofile/enable, the" ++ " kernel module probably isn't loaded.\n"); ++ printf("This binary only works with 2.6 kernels and oprofile" ++ " must have been initialised with 'opcontrol --start-daemon'.\n"); ++ return 1; ++ } ++ ++ if (stat(lockfile, &sbuf)) { ++ printf("Error: Could not find lockfile %s.\n", lockfile); ++ printf("The oprofile daemon must be running (oprofile must" ++ " have been initialised with 'opcontrol --start-daemon').\n"); ++ return 1; ++ } ++ ++ lfile = fopen(lockfile, "r"); ++ if (!lfile) { ++ printf("Error opening lockfile %s.\n", lockfile); ++ return 1; ++ } ++ ++ err = fscanf(lfile, "%lud", (unsigned long *) &dpid); ++ if (err != 1) { ++ printf("Error reading pid from lockfile %s.\n", lockfile); ++ return 1; ++ } ++ fclose(lfile); ++ ++ efile = fopen(enable, "r"); ++ if (!efile) { ++ printf("Error opening %s.\n", enable); ++ return 1; ++ } ++ ++ if (strstr(argv[0], "opstart")) { ++ printf("Starting Profiler\n"); ++ sig = SIGUSR1; ++ enb = 1; ++ } else if (strstr(argv[0], "opstop")) { ++ printf("Stopping Oprofile.\n"); ++ printf("You need to run 'opcontrol --dump' when the session" ++ " is finished.\n"); ++ sig = SIGUSR2; ++ enb = 0; ++ } else { ++ printf("Error: Please call as 'opstart' or 'opstop'\n"); ++ return 1; ++ } ++ ++ err = kill(dpid, 0); ++ if (err) { ++ printf("Error sending signal to oprofiled. Stale lockfile" ++ " (%s) ?\n", lockfile); ++ return 1; ++ } ++ ++ fprintf(efile, "%d\n", enb); ++ err = kill(dpid, sig); ++ if (err) { ++ printf("Error sending signal to oprofiled. Stale lockfile" ++ " (%s) ?\n", lockfile); ++ return 1; ++ } ++ ++ return 0; ++} ++ +Index: oprofile/configure.in +=================================================================== +--- oprofile.orig/configure.in 2008-07-02 15:13:58.000000000 +0100 ++++ oprofile/configure.in 2008-07-02 15:17:37.000000000 +0100 +@@ -16,6 +16,7 @@ + AM_CONFIG_HEADER(config.h) + + AC_PROG_RANLIB ++AC_PROG_LN_S + AC_PROG_LIBTOOL + + dnl for the man page +@@ -241,6 +242,8 @@ + doc/xsl/catalog-1.xml \ + doc/oprofile.1 \ + doc/opcontrol.1 \ ++ doc/opstart.1 \ ++ doc/opstop.1 \ + doc/ophelp.1 \ + doc/opreport.1 \ + doc/opannotate.1 \ +Index: oprofile/doc/Makefile.am +=================================================================== +--- oprofile.orig/doc/Makefile.am 2008-07-02 15:13:59.000000000 +0100 ++++ oprofile/doc/Makefile.am 2008-07-02 15:14:07.000000000 +0100 +@@ -11,6 +11,8 @@ + man_MANS = \ + oprofile.1 \ + opcontrol.1 \ ++ opstart.1 \ ++ opstop.1 \ + opreport.1 \ + opannotate.1 \ + opgprof.1 \ +Index: oprofile/doc/opstart.1.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/doc/opstart.1.in 2008-07-02 15:14:07.000000000 +0100 +@@ -0,0 +1,27 @@ ++.TH OPSTART 1 "@DATE@" "oprofile @VERSION@" ++.UC 4 ++.SH NAME ++opstart \- start OProfile profiling ++.SH SYNOPSIS ++.br ++.B opstart ++.SH DESCRIPTION ++.B opstart ++is a simple optimised command to start profiling with 2.6 Linux kernels. ++OProfile should have already been initialised by calling "opcontrol --start-daemon". ++ ++.SH ENVIRONMENT ++No special environment variables are recognised by opstart. ++ ++.SH FILES ++.TP ++.I /var/lib/oprofile/samples/ ++The location of the generated sample files. ++ ++.SH VERSION ++.TP ++This man page is current for @PACKAGE@-@VERSION@. ++ ++.SH SEE ALSO ++.BR @OP_DOCDIR@, ++.BR oprofile(1) +Index: oprofile/doc/opstop.1.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/doc/opstop.1.in 2008-07-02 15:14:07.000000000 +0100 +@@ -0,0 +1,28 @@ ++.TH OPSTOP 1 "@DATE@" "oprofile @VERSION@" ++.UC 4 ++.SH NAME ++opstop \- stop OProfile profiling ++.SH SYNOPSIS ++.br ++.B opstop ++.SH DESCRIPTION ++.B opstop ++is a simple optimsed command to stop profiling with 2.6 Linux kernels. ++You need to run "opcontrol --dump" before being able to view a profile ++with opreport. ++ ++.SH ENVIRONMENT ++No special environment variables are recognised by opstop. ++ ++.SH FILES ++.TP ++.I /var/lib/oprofile/samples/ ++The location of the generated sample files. ++ ++.SH VERSION ++.TP ++This man page is current for @PACKAGE@-@VERSION@. ++ ++.SH SEE ALSO ++.BR @OP_DOCDIR@, ++.BR oprofile(1) diff --git a/meta/recipes-kernel/oprofile/oprofile/xml_callgraph_details.patch b/meta/recipes-kernel/oprofile/oprofile/xml_callgraph_details.patch new file mode 100644 index 00000000000..e5ab3d916e2 --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofile/xml_callgraph_details.patch @@ -0,0 +1,232 @@ +Work in Progress- This patch breaks output_symbol_bytes +--- + ChangeLog | 9 +++++++++ + libpp/callgraph_container.cpp | 10 ++++++++-- + libpp/callgraph_container.h | 14 ++++++++++---- + libpp/format_output.cpp | 30 +++++++++++++++++++++++++----- + libpp/format_output.h | 6 +++--- + pp/opreport.cpp | 5 +++-- + pp/opreport_options.cpp | 4 ++-- + 7 files changed, 60 insertions(+), 18 deletions(-) + +Index: oprofile1/pp/opreport.cpp +=================================================================== +--- oprofile1.orig/pp/opreport.cpp 2007-05-24 15:32:20.000000000 +0100 ++++ oprofile1/pp/opreport.cpp 2007-05-24 20:07:14.000000000 +0100 +@@ -555,10 +555,11 @@ int opreport(options::spec const & spec) + + output_diff_symbols(pc1, pc2, multiple_apps); + } else if (options::callgraph) { +- callgraph_container cg_container; ++ callgraph_container cg_container(options::debug_info, ++ options::details); + cg_container.populate(options::archive_path, iprofiles, + options::extra_found_images, +- options::debug_info, options::threshold, ++ options::threshold, + options::merge_by.lib, options::symbol_filter); + + output_cg_symbols(cg_container, multiple_apps); +Index: oprofile1/ChangeLog +=================================================================== +--- oprofile1.orig/ChangeLog 2007-05-24 18:30:47.000000000 +0100 ++++ oprofile1/ChangeLog 2007-05-24 20:07:14.000000000 +0100 +@@ -1,5 +1,14 @@ + 2007-05-24 Richard Purdie <rpurdie@openedhand.com> + ++ * libpp/callgraph_container.cpp: ++ * libpp/callgraph_container.h: ++ * libpp/format_output.cpp: ++ * libpp/format_output.h: ++ * pp/opreport.cpp: ++ * pp/opreport_options.cpp: Add callgraph XML detail support ++ ++2007-05-24 Richard Purdie <rpurdie@openedhand.com> ++ + * events/arm/xscale1/events: + * events/arm/xscale2/events: Add extra Xscale PMU event definitions + +Index: oprofile1/libpp/callgraph_container.cpp +=================================================================== +--- oprofile1.orig/libpp/callgraph_container.cpp 2007-05-24 15:32:20.000000000 +0100 ++++ oprofile1/libpp/callgraph_container.cpp 2007-05-24 20:07:14.000000000 +0100 +@@ -391,15 +391,21 @@ const symbol_collection & arc_recorder:: + return cg_syms; + } + ++callgraph_container::callgraph_container(bool debug_info, bool need_details) ++ : ++ pc(debug_info, need_details), ++ debug_info(debug_info) ++{ ++} ++ + + void callgraph_container::populate(string const & archive_path, + list<inverted_profile> const & iprofiles, +- extra_images const & extra, bool debug_info, double threshold, ++ extra_images const & extra, double threshold, + bool merge_lib, string_filter const & sym_filter) + { + // non callgraph samples container, we record sample at symbol level + // not at vma level. +- profile_container pc(debug_info, false); + + list<inverted_profile>::const_iterator it; + list<inverted_profile>::const_iterator const end = iprofiles.end(); +Index: oprofile1/libpp/callgraph_container.h +=================================================================== +--- oprofile1.orig/libpp/callgraph_container.h 2007-05-24 15:32:20.000000000 +0100 ++++ oprofile1/libpp/callgraph_container.h 2007-05-24 20:07:14.000000000 +0100 +@@ -19,8 +19,8 @@ + #include "symbol.h" + #include "symbol_functors.h" + #include "string_filter.h" ++#include "profile_container.h" + +-class profile_container; + class inverted_profile; + class profile_t; + class extra_images; +@@ -103,6 +103,8 @@ private: + */ + class callgraph_container { + public: ++ callgraph_container(bool debug_info, bool need_details); ++ + /** + * Populate the container, must be called once only. + * @param archive_path oparchive prefix path +@@ -118,9 +120,8 @@ public: + */ + void populate(std::string const & archive_path, + std::list<inverted_profile> const & iprofiles, +- extra_images const & extra, bool debug_info, +- double threshold, bool merge_lib, +- string_filter const & sym_filter); ++ extra_images const & extra, double threshold, ++ bool merge_lib, string_filter const & sym_filter); + + /// return hint on how data must be displayed. + column_flags output_hint() const; +@@ -131,6 +132,9 @@ public: + // return all the cg symbols + const symbol_collection & get_symbols() const; + ++ // profile container callgraph is based on ++ profile_container pc; ++ + private: + /** + * Record caller/callee for one cg file +@@ -162,6 +166,8 @@ private: + profile_container const & pc, bool debug_info, + bool merge_lib); + ++ bool debug_info; ++ + /// record all main symbols + void add_symbols(profile_container const & pc); + +Index: oprofile1/pp/opreport_options.cpp +=================================================================== +--- oprofile1.orig/pp/opreport_options.cpp 2007-05-24 15:32:20.000000000 +0100 ++++ oprofile1/pp/opreport_options.cpp 2007-05-24 20:07:14.000000000 +0100 +@@ -165,8 +165,8 @@ void check_options(bool diff) + + if (callgraph) { + symbols = true; +- if (details) { +- cerr << "--callgraph is incompatible with --details" << endl; ++ if (details && !xml) { ++ cerr << "--callgraph is incompatible with --details without --xml" << endl; + do_exit = true; + } + +Index: oprofile1/libpp/format_output.cpp +=================================================================== +--- oprofile1.orig/libpp/format_output.cpp 2007-05-24 15:32:20.000000000 +0100 ++++ oprofile1/libpp/format_output.cpp 2007-05-24 20:07:14.000000000 +0100 +@@ -594,9 +594,9 @@ xml_formatter:: + xml_formatter(profile_container const * p, + symbol_collection & s) + : ++ need_details(false), + profile(p), +- symbols(s), +- need_details(false) ++ symbols(s) + { + if (profile) + counts.total = profile->samples_count(); +@@ -673,8 +673,8 @@ void xml_formatter::output_symbol_data(o + if (name.size() > 0 && name[0] != '?') { + output_attribute(out, datum, ff_vma, STARTING_ADDR); + +- if (need_details) +- xml_support->output_symbol_bytes(bytes_out, symb, sd_it->second); ++ //if (need_details) ++ // xml_support->output_symbol_bytes(bytes_out, symb, sd_it->second); + } + out << close_element(); + +@@ -843,7 +843,7 @@ output_attribute(ostream & out, field_da + xml_cg_formatter:: + xml_cg_formatter(callgraph_container const * cg, symbol_collection & s) + : +- xml_formatter(0, s), ++ xml_formatter(&cg->pc, s), + callgraph(cg) + { + counts.total = callgraph->samples_count(); +@@ -946,6 +946,26 @@ output_symbol(ostream & out, + + out << init_attr(ID_REF, indx); + ++ if (need_details) { ++ ostringstream details; ++ symbol_details_t & sd = symbol_details[indx]; ++ size_t const detail_lo = sd.index; ++ ++ string detail_str = output_symbol_details(symb, sd.index, lo, hi); ++ ++ if (detail_str.size() > 0) { ++ if (sd.id < 0) ++ sd.id = indx; ++ details << detail_str; ++ } ++ ++ if (sd.index > detail_lo) { ++ sd.details = sd.details + details.str(); ++ out << init_attr(DETAIL_LO, detail_lo); ++ out << init_attr(DETAIL_HI, sd.index-1); ++ } ++ } ++ + out << close_element(NONE, true); + + out << open_element(CALLERS); +Index: oprofile1/libpp/format_output.h +=================================================================== +--- oprofile1.orig/libpp/format_output.h 2007-05-24 15:32:20.000000000 +0100 ++++ oprofile1/libpp/format_output.h 2007-05-24 20:07:14.000000000 +0100 +@@ -249,6 +249,9 @@ public: + // output SymbolData XML elements + void output_symbol_data(std::ostream & out); + ++ /// true if we need to show details for each symbols ++ bool need_details; ++ + private: + /// container we work from + profile_container const * profile; +@@ -256,9 +259,6 @@ private: + // ordered collection of symbols associated with this profile + symbol_collection & symbols; + +- /// true if we need to show details for each symbols +- bool need_details; +- + // count of DetailData items output so far + size_t detail_count; + diff --git a/meta/recipes-kernel/oprofile/oprofile_0.9.6.bb b/meta/recipes-kernel/oprofile/oprofile_0.9.6.bb new file mode 100644 index 00000000000..9679411becf --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofile_0.9.6.bb @@ -0,0 +1,31 @@ +DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \ +of profiling all running code at low overhead." +HOMEPAGE = "http://oprofile.sourceforge.net/news/" +BUGTRACKER = "http://sourceforge.net/tracker/?group_id=16191&atid=116191" + +LICENSE = "LGPLv2.1+ & GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ + file://libopagent/opagent.h;beginline=5;endline=26;md5=4f16f72c7a493d8a4704aa18d03d15c6 \ + file://daemon/liblegacy/p_module.h;beginline=2;endline=20;md5=fc23a43455edf185307274a99730b6e4" + +SECTION = "devel" + +DEPENDS = "popt binutils" +RDEPENDS = "binutils-symlinks" +RRECOMMENDS = "kernel-vmlinux" + +PR = "r0" + +SRC_URI = "${SOURCEFORGE_MIRROR}/oprofile/oprofile-${PV}.tar.gz \ + file://opstart.patch \ + file://acinclude.m4" +S = "${WORKDIR}/oprofile-${PV}" + +inherit autotools + +EXTRA_OECONF = "--with-kernel-support --without-x" + +do_configure () { + cp ${WORKDIR}/acinclude.m4 ${S}/ + autotools_do_configure +} diff --git a/meta/recipes-kernel/oprofile/oprofile_cvs.bb b/meta/recipes-kernel/oprofile/oprofile_cvs.bb new file mode 100644 index 00000000000..dd8dd588637 --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofile_cvs.bb @@ -0,0 +1,27 @@ +PV = "0.9.4+cvs${SRCDATE}" +PR = "r0" +SECTION = "devel" +DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \ +of profiling all running code at low overhead." +LICENSE = "GPL" +DEPENDS = "popt binutils" +RDEPENDS = "binutils-symlinks" +RRECOMMENDS = "kernel-vmlinux" + +DEFAULT_PREFERENCE = "-1" + +SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=oprofile \ + file://opstart.patch;patch=1 \ + file://acinclude.m4" +S = "${WORKDIR}/oprofile" + +inherit autotools + +EXTRA_OECONF = "--with-kernel-support \ + --without-x \ + --disable-werror " + +do_configure () { + cp ${WORKDIR}/acinclude.m4 ${S}/ + autotools_do_configure +} diff --git a/meta/recipes-kernel/oprofile/oprofileui-svn.inc b/meta/recipes-kernel/oprofile/oprofileui-svn.inc new file mode 100644 index 00000000000..4c9211cc050 --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofileui-svn.inc @@ -0,0 +1,8 @@ +require oprofileui.inc + +PV = "0.0+svnr${SRCREV}" +PR = "r0" + +S = "${WORKDIR}/trunk" + +SRC_URI = "svn://svn.o-hand.com/repos/oprofileui;module=trunk;proto=http" diff --git a/meta/recipes-kernel/oprofile/oprofileui.inc b/meta/recipes-kernel/oprofile/oprofileui.inc new file mode 100644 index 00000000000..22b56a584ff --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofileui.inc @@ -0,0 +1,22 @@ +DESCRIPTION = "User interface for the OProfile tool" +HOMEPAGE = "http://labs.o-hand.com/oprofileui/" +BUGTRACKER = "http://bugzilla.o-hand.com/" + +SECTION = "x11" + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" + +DEPENDS = "glib-2.0 gtk+ libglade gnome-vfs libxml2 avahi gconf" + +inherit autotools pkgconfig gtk-icon-cache + +PACKAGES =+ "oprofileui-server oprofileui-viewer" + +EXTRA_OECONF = "--with-avahi" + +FILES_oprofileui-viewer = "${bindir}/oparchconv ${bindir}/oprofile-viewer ${datadir}/applications/ ${datadir}/oprofileui/" +RDEPENDS_oprofile-viewer = "oprofile" + +FILES_oprofileui-server = "${bindir}/oprofile-server" +RDEPENDS_oprofile-server = "oprofile" diff --git a/meta/recipes-kernel/oprofile/oprofileui_svn.bb b/meta/recipes-kernel/oprofile/oprofileui_svn.bb new file mode 100644 index 00000000000..39e10b4fd27 --- /dev/null +++ b/meta/recipes-kernel/oprofile/oprofileui_svn.bb @@ -0,0 +1,2 @@ +require oprofileui-svn.inc + |