OSDN Git Service

resolved conflicts for 6239958b to stage-aosp-master
authorYabin Cui <yabinc@google.com>
Mon, 21 Sep 2015 19:28:46 +0000 (12:28 -0700)
committerYabin Cui <yabinc@google.com>
Mon, 21 Sep 2015 19:28:46 +0000 (12:28 -0700)
Change-Id: I66d12e9a15b5e6aecd4938b9ce4ac76a0f3863e4

simpleperf/event_fd.cpp
simpleperf/event_type.cpp
simpleperf/workload.cpp

index 9c5e4ab..29be60f 100644 (file)
@@ -48,14 +48,23 @@ std::unique_ptr<EventFd> EventFd::OpenEventFile(const perf_event_attr& attr, pid
   }
   int perf_event_fd = perf_event_open(&perf_attr, tid, cpu, -1, 0);
   if (perf_event_fd == -1) {
-    (report_error ? PLOG(ERROR) : PLOG(DEBUG)) << "open perf_event_file (event " << event_name
-                                               << ", tid " << tid << ", cpu " << cpu << ") failed";
+    if (report_error) {
+      PLOG(ERROR) << "open perf_event_file (event " << event_name << ", tid " << tid << ", cpu "
+                  << cpu << ") failed";
+    } else {
+      PLOG(DEBUG) << "open perf_event_file (event " << event_name << ", tid " << tid << ", cpu "
+                  << cpu << ") failed";
+    }
     return nullptr;
   }
   if (fcntl(perf_event_fd, F_SETFD, FD_CLOEXEC) == -1) {
-    (report_error ? PLOG(ERROR) : PLOG(DEBUG)) << "fcntl(FD_CLOEXEC) for perf_event_file (event "
-                                               << event_name << ", tid " << tid << ", cpu " << cpu
-                                               << ") failed";
+    if (report_error) {
+      PLOG(ERROR) << "fcntl(FD_CLOEXEC) for perf_event_file (event " << event_name << ", tid "
+                  << tid << ", cpu " << cpu << ") failed";
+    } else {
+      PLOG(DEBUG) << "fcntl(FD_CLOEXEC) for perf_event_file (event " << event_name << ", tid "
+                  << tid << ", cpu " << cpu << ") failed";
+    }
     return nullptr;
   }
   return std::unique_ptr<EventFd>(new EventFd(perf_event_fd, event_name, tid, cpu));
index 1d0243c..4f13979 100644 (file)
@@ -28,9 +28,7 @@
 #include "event_fd.h"
 #include "utils.h"
 
-#define EVENT_TYPE_TABLE_ENTRY(name, type, config) \
-  { name, type, config }                           \
-  ,
+#define EVENT_TYPE_TABLE_ENTRY(name, type, config) {name, type, config},
 
 static const std::vector<EventType> static_event_type_array = {
 #include "event_type_table.h"
index 6f07cda..7e129b3 100644 (file)
@@ -108,9 +108,9 @@ static void ChildProcessFn(std::vector<std::string>& args, int start_signal_fd,
     TEMP_FAILURE_RETRY(write(exec_child_fd, &exec_child_failed, 1));
     close(exec_child_fd);
     errno = saved_errno;
-    PLOG(ERROR) << "execvp(" << argv[0] << ") failed";
+    PLOG(ERROR) << "child process failed to execvp(" << argv[0] << ")";
   } else {
-    PLOG(DEBUG) << "child process failed to receive start_signal, nread = " << nread;
+    PLOG(ERROR) << "child process failed to receive start_signal, nread = " << nread;
   }
   exit(1);
 }
@@ -126,7 +126,11 @@ bool Workload::Start() {
   char exec_child_failed;
   ssize_t nread = TEMP_FAILURE_RETRY(read(exec_child_fd_, &exec_child_failed, 1));
   if (nread != 0) {
-    ((nread == -1) ? PLOG(ERROR) : LOG(ERROR)) << "exec child failed, nread = " << nread;
+    if (nread == -1) {
+      PLOG(ERROR) << "failed to receive error message from child process";
+    } else {
+      LOG(ERROR) << "received error message from child process";
+    }
     return false;
   }
   work_state_ = Started;