Blame SOURCES/oprofile-order.patch

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