}
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));
#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"
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);
}
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;