From patchwork Mon Apr 28 09:34:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: christian.braunersorensen@prevas.dk X-Patchwork-Id: 343459 X-Patchwork-Delegate: esben@haabendal.dk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hugin.dotsrc.org (hugin.dotsrc.org [130.225.254.102]) by ozlabs.org (Postfix) with ESMTP id 0017514008B for ; Tue, 29 Apr 2014 00:44:36 +1000 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id 7707A3FCD2 for ; Mon, 28 Apr 2014 16:44:34 +0200 (CEST) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail02.prevas.se (mail02.prevas.se [62.95.78.10]) by hugin.dotsrc.org (Postfix) with ESMTPS id B00943F9C1 for ; Mon, 28 Apr 2014 16:44:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=10717; q=dns/txt; s=ironport2; t=1398696271; x=1430232271; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=0VAz/55K5HuY0Cges0nZcIjP9h1oLxDKiVCblzz+Pnk=; b=pVI6R1Ew5d7y46DbhUqUhsDK/tszwEP+hovhOvR7HXTbSaPVmNzvBT9p zyz+yb7MFHitXKr7PPpeH3DfaMEVE8y4JBr7ojqGIG7mEWVdImWUnU9Fd dzewcpZj3qqXRhu8XKzzt3l9rw/GFdVqlhPWZUOHmNEo1H9MK+HkackGV U=; X-IronPort-AV: E=Sophos;i="4.97,942,1389740400"; d="scan'208";a="535026" Received: from vmprevas3.prevas.se (HELO smtp.prevas.se) ([172.16.8.103]) by ironport2.prevas.se with ESMTP/TLS/AES128-SHA; 28 Apr 2014 11:35:05 +0200 Received: from localhost (172.16.10.102) by smtp.prevas.se (172.16.8.105) with Microsoft SMTP Server id 14.2.347.0; Mon, 28 Apr 2014 11:35:05 +0200 Received: by localhost (Postfix, from userid 30007) id 02B39681EB8; Mon, 28 Apr 2014 09:35:05 +0000 (UTC) From: To: Subject: [PATCH 1/3] oprofile: Add new recipe for oprofile version 0.9.9 Date: Mon, 28 Apr 2014 09:34:54 +0000 Message-ID: X-Mailer: git-send-email 1.8.4 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org From: Christian Sørensen Signed-off-by: Christian Sørensen --- recipes/oprofile/oprofile.inc | 50 +++++++ recipes/oprofile/oprofile/opstart.patch | 245 ++++++++++++++++++++++++++++++++ recipes/oprofile/oprofile_0.9.9.oe | 6 + recipes/oprofile/oprofile_0.9.9.oe.sig | 1 + 4 files changed, 302 insertions(+) create mode 100644 recipes/oprofile/oprofile.inc create mode 100644 recipes/oprofile/oprofile/opstart.patch create mode 100644 recipes/oprofile/oprofile_0.9.9.oe create mode 100644 recipes/oprofile/oprofile_0.9.9.oe.sig diff --git a/recipes/oprofile/oprofile.inc b/recipes/oprofile/oprofile.inc new file mode 100644 index 0000000..7e73fb8 --- /dev/null +++ b/recipes/oprofile/oprofile.inc @@ -0,0 +1,50 @@ +SUMMARY = "System-Wide Profiler" +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 = "LGPL-2.1+ & GPL-2.0" + +inherit autotools pkgconfig c++ + +DEPENDS = "libpopt binutils-dev kernel-dev" + +FILES_${PN} = "${bindir} ${libdir}/${PN}/lib*${SOLIBS} ${datadir}/${PN}" +FILES_${PN}-dev += "${libdir}/${PN}/lib*${SOLIBSDEV} ${libdir}/${PN}/lib*.la" +FILES_${PN}-staticdev += "${libdir}/${PN}/lib*.a" + +SRC_URI += "file://opstart.patch" + +EXTRA_OECONF = "--with-kernel=${HOST_SYSROOT}${kernelsrcdir} --without-x" + +inherit auto-package-utils +AUTO_PACKAGE_UTILS = "opannotate oparchive op-check-perfevents \ + opcontrol opgprof ophelp opimport opjitconv opreport oprofiled" +AUTO_PACKAGE_UTILS_DEPENDS = "libc" +AUTO_PACKAGE_UTILS_RDEPENDS = "${PN} libc" +DEPENDS_${PN}-opannotate += "libbfd libgcc-s libm libpopt libstdc++" +RDEPENDS_${PN}-opannotate += "libbfd libgcc-s libm libpopt libstdc++" +DEPENDS_${PN}-oparchive += "libbfd libgcc-s libm libpopt libstdc++" +RDEPENDS_${PN}-oparchive += "libbfd libgcc-s libm libpopt libstdc++" +DEPENDS_${PN}-op-check-perfevents += "libpopt" +RDEPENDS_${PN}-op-check-perfevents += "libpopt" +DEPENDS_${PN}-opgprof += "libbfd libgcc-s libm libpopt libstdc++" +RDEPENDS_${PN}-opgprof += "libbfd libgcc-s libm libpopt libstdc++" +DEPENDS_${PN}-ophelp += "libpopt" +RDEPENDS_${PN}-ophelp += "libpopt" +DEPENDS_${PN}-opimport += "libgcc-s libm libpopt libstdc++" +RDEPENDS_${PN}-opimport += "libgcc-s libm libpopt libstdc++" +DEPENDS_${PN}-opjitconv += "libbfd" +RDEPENDS_${PN}-opjitconv += "libbfd" +DEPENDS_${PN}-opreport += "libbfd libgcc-s libm libpopt libstdc++" +RDEPENDS_${PN}-opreport += "libbfd libgcc-s libm libpopt libstdc++" +DEPENDS_${PN}-oprofiled += "libpopt" +RDEPENDS_${PN}-oprofiled += "libpopt" + +inherit auto-package-libs +AUTO_PACKAGE_LIBS = "opagent" +AUTO_PACKAGE_LIBS_LIBDIR = "${libdir}/oprofile:lib::.so.*:.so,.la,.a" +DEPENDS_${PN}-libopagent += "libbfd libc" +RDEPENDS_${PN}-libopagent += "libbfd libc" +FILES_${PN}-libopagent-dev += "${includedir}/opagent.h" diff --git a/recipes/oprofile/oprofile/opstart.patch b/recipes/oprofile/oprofile/opstart.patch new file mode 100644 index 0000000..8696f4e --- /dev/null +++ b/recipes/oprofile/oprofile/opstart.patch @@ -0,0 +1,245 @@ +Upstream-Status: Pending + +The patch gives a low overhead way of starting/stopping oprofile which +doesn't involve script exection. + +(written by RP in OpenedHand days) + +diff --git a/utils/Makefile.am b/utils/Makefile.am +index d34b060..dff15f9 100644 +--- oprofile.orig/utils/Makefile.am ++++ oprofile/utils/Makefile.am +@@ -7,7 +7,7 @@ AM_LDFLAGS = @OP_LDFLAGS@ + + LIBS=@POPT_LIBS@ @LIBERTY_LIBS@ + +-bin_PROGRAMS = ophelp op-check-perfevents ++bin_PROGRAMS = ophelp op-check-perfevents opstart + dist_bin_SCRIPTS = opcontrol + + op_check_perfevents_SOURCES = op_perf_events_checker.c +@@ -15,3 +15,10 @@ op_check_perfevents_CPPFLAGS = ${AM_CFLAGS} @PERF_EVENT_FLAGS@ + + 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 ++#include ++#include ++#include ++#include ++#include ++#include ++ ++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.ac +=================================================================== +--- oprofile.orig/configure.ac 2008-07-02 15:13:58.000000000 +0100 ++++ oprofile/configure.ac 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/recipes/oprofile/oprofile_0.9.9.oe b/recipes/oprofile/oprofile_0.9.9.oe new file mode 100644 index 0000000..dfdcaa0 --- /dev/null +++ b/recipes/oprofile/oprofile_0.9.9.oe @@ -0,0 +1,6 @@ +require oprofile.inc + +require conf/fetch/sourceforge.conf +SRC_URI += "${SOURCEFORGE_MIRROR}/${PN}/${PN}-${PV}.tar.gz" + +S = "${SRCDIR}/oprofile-${PV}" diff --git a/recipes/oprofile/oprofile_0.9.9.oe.sig b/recipes/oprofile/oprofile_0.9.9.oe.sig new file mode 100644 index 0000000..0d90bd9 --- /dev/null +++ b/recipes/oprofile/oprofile_0.9.9.oe.sig @@ -0,0 +1 @@ +02a1f6609affb04a348dbddfdf8f03e66154f5be oprofile-0.9.9.tar.gz