Blame SOURCES/oprofile-order.patch

d5df0a
From c95158840a7914d558a93b044c5ab0eeb0ea9337 Mon Sep 17 00:00:00 2001
d5df0a
From: William Cohen <wcohen@redhat.com>
d5df0a
Date: Tue, 9 Aug 2016 22:25:52 -0400
d5df0a
Subject: [PATCH] Only start the application if the perf events setup was
d5df0a
 successful
d5df0a
d5df0a
The code was starting the application before the performance events
d5df0a
were setup.  In some cases the the setup of the perf events may fail
d5df0a
and the code needs to verify that the performance events have been
d5df0a
successfully set up before starting the application.  Changed the
d5df0a
order of those steps to allow a check of the perf event setup before
d5df0a
launching the application.
d5df0a
d5df0a
Signed-off-by: William Cohen <wcohen@redhat.com>
d5df0a
---
d5df0a
 pe_counting/ocount.cpp | 20 ++++++++++----------
d5df0a
 1 file changed, 10 insertions(+), 10 deletions(-)
d5df0a
d5df0a
diff --git a/pe_counting/ocount.cpp b/pe_counting/ocount.cpp
d5df0a
index 4d9c104..7717717 100644
d5df0a
--- a/pe_counting/ocount.cpp
d5df0a
+++ b/pe_counting/ocount.cpp
d5df0a
@@ -257,16 +257,6 @@ bool start_counting(void)
d5df0a
 		proc_list = ocount_options::processes;
d5df0a
 	}
d5df0a
 
d5df0a
-	if (startApp) {
d5df0a
-		// Tell app_PID to start the app
d5df0a
-		cverb << vdebug << "telling child to start app" << endl;
d5df0a
-		if (write(start_app_pipe[1], &startup, sizeof(startup)) < 0) {
d5df0a
-			perror("Internal error on start_app_pipe");
d5df0a
-			return -1;
d5df0a
-		}
d5df0a
-		app_started = true;
d5df0a
-	}
d5df0a
-
d5df0a
 	orecord = new ocount_record(runmode, events, ocount_options::display_interval ? true : false);
d5df0a
 	bool ret;
d5df0a
 	switch (runmode) {
d5df0a
@@ -300,6 +290,16 @@ bool start_counting(void)
d5df0a
 		ret = false;
d5df0a
 	}
d5df0a
 
d5df0a
+	if (startApp && ret != false) {
d5df0a
+		// Tell app_PID to start the app
d5df0a
+		cverb << vdebug << "telling child to start app" << endl;
d5df0a
+		if (write(start_app_pipe[1], &startup, sizeof(startup)) < 0) {
d5df0a
+			perror("Internal error on start_app_pipe");
d5df0a
+			return false;
d5df0a
+		}
d5df0a
+		app_started = true;
d5df0a
+	}
d5df0a
+
d5df0a
 	return ret;
d5df0a
 }
d5df0a
 
d5df0a
-- 
d5df0a
2.7.4
d5df0a