summaryrefslogtreecommitdiff
path: root/memory_replay
diff options
context:
space:
mode:
Diffstat (limited to 'memory_replay')
-rw-r--r--memory_replay/NativeInfo.cpp2
-rw-r--r--memory_replay/Pointers.cpp8
-rw-r--r--memory_replay/Threads.cpp14
-rw-r--r--memory_replay/TraceBenchmark.cpp2
4 files changed, 12 insertions, 14 deletions
diff --git a/memory_replay/NativeInfo.cpp b/memory_replay/NativeInfo.cpp
index 8493b682..433b6b90 100644
--- a/memory_replay/NativeInfo.cpp
+++ b/memory_replay/NativeInfo.cpp
@@ -95,7 +95,7 @@ void NativePrintInfo(const char* preamble) {
android::base::unique_fd smaps_fd(open("/proc/self/smaps", O_RDONLY));
if (smaps_fd == -1) {
- err(1, "Cannot open /proc/self/smaps: %s\n", strerror(errno));
+ err(1, "Cannot open /proc/self/smaps");
}
NativeGetInfo(smaps_fd, &rss_bytes, &va_bytes);
diff --git a/memory_replay/Pointers.cpp b/memory_replay/Pointers.cpp
index 6335dc2c..b04b9310 100644
--- a/memory_replay/Pointers.cpp
+++ b/memory_replay/Pointers.cpp
@@ -35,7 +35,7 @@ Pointers::Pointers(size_t max_allocs) {
void* memory =
mmap(nullptr, pointers_size_, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
if (memory == MAP_FAILED) {
- err(1, "Unable to allocate data for pointer hash: %zu total_allocs\n", max_allocs);
+ err(1, "Unable to allocate data for pointer hash: %zu total_allocs", max_allocs);
}
// Set all of the pointers to be empty.
memset(memory, 0, pointers_size_);
@@ -52,7 +52,7 @@ Pointers::~Pointers() {
void Pointers::Add(uintptr_t key_pointer, void* pointer) {
pointer_data* data = FindEmpty(key_pointer);
if (data == nullptr) {
- err(1, "No empty entry found for 0x%" PRIxPTR "\n", key_pointer);
+ errx(1, "No empty entry found for 0x%" PRIxPTR, key_pointer);
}
atomic_store(&data->key_pointer, key_pointer);
data->pointer = pointer;
@@ -60,12 +60,12 @@ void Pointers::Add(uintptr_t key_pointer, void* pointer) {
void* Pointers::Remove(uintptr_t key_pointer) {
if (key_pointer == 0) {
- err(1, "Illegal zero value passed to Remove\n");
+ errx(1, "Illegal zero value passed to Remove");
}
pointer_data* data = Find(key_pointer);
if (data == nullptr) {
- err(1, "No pointer value found for 0x%" PRIxPTR "\n", key_pointer);
+ errx(1, "No pointer value found for 0x%" PRIxPTR, key_pointer);
}
void* pointer = data->pointer;
diff --git a/memory_replay/Threads.cpp b/memory_replay/Threads.cpp
index 61f950ee..15fc69f1 100644
--- a/memory_replay/Threads.cpp
+++ b/memory_replay/Threads.cpp
@@ -54,8 +54,8 @@ Threads::Threads(Pointers* pointers, size_t max_threads)
void* memory = mmap(nullptr, data_size_, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
if (memory == MAP_FAILED) {
- err(1, "Failed to map in memory for Threads: map size %zu, max threads %zu\n",
- data_size_, max_threads_);
+ err(1, "Failed to map in memory for Threads: map size %zu, max threads %zu", data_size_,
+ max_threads_);
}
threads_ = new (memory) Thread[max_threads_];
@@ -71,18 +71,17 @@ Threads::~Threads() {
Thread* Threads::CreateThread(pid_t tid) {
if (num_threads_ == max_threads_) {
- err(1, "Too many threads created, current max %zu.\n", num_threads_);
+ errx(1, "Too many threads created, current max %zu", num_threads_);
}
Thread* thread = FindEmptyEntry(tid);
if (thread == nullptr) {
- err(1, "No empty entries found, current max %zu, num threads %zu\n",
- max_threads_, num_threads_);
+ errx(1, "No empty entries found, current max %zu, num threads %zu", max_threads_, num_threads_);
}
thread->tid_ = tid;
thread->pointers_ = pointers_;
thread->total_time_nsecs_ = 0;
if ((errno = pthread_create(&thread->thread_id_, nullptr, ThreadRunner, thread)) != 0) {
- err(1, "Failed to create thread %d: %s\n", tid, strerror(errno));
+ err(1, "Failed to create thread %d", tid);
}
num_threads_++;
@@ -136,8 +135,7 @@ Thread* Threads::FindEmptyEntry(pid_t tid) {
void Threads::Finish(Thread* thread) {
int ret = pthread_join(thread->thread_id_, nullptr);
if (ret != 0) {
- fprintf(stderr, "pthread_join failed: %s\n", strerror(ret));
- exit(1);
+ err(1, "pthread_join failed");
}
total_time_nsecs_ += thread->total_time_nsecs_;
thread->tid_ = 0;
diff --git a/memory_replay/TraceBenchmark.cpp b/memory_replay/TraceBenchmark.cpp
index 0a7dc90b..9d1a0493 100644
--- a/memory_replay/TraceBenchmark.cpp
+++ b/memory_replay/TraceBenchmark.cpp
@@ -142,7 +142,7 @@ static void GetTraceData(const std::string& filename, TraceDataType* trace_data)
}
void* map = mmap(nullptr, sizeof(void*) * trace_data->num_ptrs, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
if (map == MAP_FAILED) {
- err(1, "mmap failed\n");
+ err(1, "mmap failed");
}
trace_data->ptrs = reinterpret_cast<void**>(map);