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