Blame SOURCES/oprofile-startup.patch

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