aboutsummaryrefslogtreecommitdiff
path: root/profiling
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2018-02-23 11:33:20 -0800
committerMiao Wang <miaowang@google.com>2018-02-23 11:40:25 -0800
commit7d0d5a611e629e7c8946e6720baa6846ade9f015 (patch)
treea6ece8759b2fc774b39edea08417e08fa633a73c /profiling
parent8a6b22a5d1f7db709938f33ad5f836dc3aaa7e31 (diff)
downloadgemmlowp-o-mr1-iot-preview-7.tar.gz
Test: mm Test: NeuralNetworksTests pass Change-Id: I2acafc240269ed81997a3a9d06321cbc2ca5e528
Diffstat (limited to 'profiling')
-rw-r--r--profiling/instrumentation.h13
-rw-r--r--profiling/pthread_everywhere.h42
2 files changed, 21 insertions, 34 deletions
diff --git a/profiling/instrumentation.h b/profiling/instrumentation.h
index 539076a..437fe54 100644
--- a/profiling/instrumentation.h
+++ b/profiling/instrumentation.h
@@ -24,7 +24,6 @@
#ifndef GEMMLOWP_PROFILING_INSTRUMENTATION_H_
#define GEMMLOWP_PROFILING_INSTRUMENTATION_H_
-#include <pthread.h>
#include <cstdio>
#ifndef GEMMLOWP_USE_STLPORT
@@ -32,15 +31,15 @@
#else
#include <stdint.h>
namespace std {
-using ::uint8_t;
-using ::uint16_t;
-using ::uint32_t;
-using ::int8_t;
using ::int16_t;
using ::int32_t;
+using ::int8_t;
using ::size_t;
+using ::uint16_t;
+using ::uint32_t;
+using ::uint8_t;
using ::uintptr_t;
-}
+} // namespace std
#endif
#include <algorithm>
@@ -52,6 +51,8 @@ using ::uintptr_t;
#include <set>
#endif
+#include "./pthread_everywhere.h"
+
namespace gemmlowp {
inline void ReleaseBuildAssertion(bool condition, const char* msg) {
diff --git a/profiling/pthread_everywhere.h b/profiling/pthread_everywhere.h
index 7e12d66..df17c6f 100644
--- a/profiling/pthread_everywhere.h
+++ b/profiling/pthread_everywhere.h
@@ -18,8 +18,6 @@
#ifndef GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_
#define GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_
-#include "pthread_everywhere.h"
-
#ifndef _WIN32
#define GEMMLOWP_USE_PTHREAD
#endif
@@ -39,39 +37,29 @@
// structs; ours take nullptr_t. That is because gemmlowp always passes
// nullptr at the moment, so any support we would code for non-null
// attribs would be unused.
-#include <thread>
-#include <mutex>
#include <condition_variable>
#include <cstddef>
+#include <mutex>
+#include <thread>
namespace gemmlowp {
-using pthread_t = std::thread*;
-using pthread_mutex_t = std::mutex*;
-using pthread_cond_t = std::condition_variable*;
-inline void pthread_create(pthread_t* thread, std::nullptr_t,
- void *(*start_routine) (void *), void *arg) {
+using pthread_t = std::thread *;
+using pthread_mutex_t = std::mutex *;
+using pthread_cond_t = std::condition_variable *;
+inline void pthread_create(pthread_t *thread, std::nullptr_t,
+ void *(*start_routine)(void *), void *arg) {
*thread = new std::thread(start_routine, arg);
}
-inline void pthread_join(pthread_t thread, std::nullptr_t) {
- thread->join();
-}
+inline void pthread_join(pthread_t thread, std::nullptr_t) { thread->join(); }
inline void pthread_mutex_init(pthread_mutex_t *mutex, std::nullptr_t) {
*mutex = new std::mutex;
}
-inline void pthread_mutex_lock(pthread_mutex_t* mutex) {
- (*mutex)->lock();
-}
-inline void pthread_mutex_unlock(pthread_mutex_t* mutex) {
- (*mutex)->unlock();
-}
-inline void pthread_mutex_destroy(pthread_mutex_t *mutex) {
- delete *mutex;
-}
+inline void pthread_mutex_lock(pthread_mutex_t *mutex) { (*mutex)->lock(); }
+inline void pthread_mutex_unlock(pthread_mutex_t *mutex) { (*mutex)->unlock(); }
+inline void pthread_mutex_destroy(pthread_mutex_t *mutex) { delete *mutex; }
inline void pthread_cond_init(pthread_cond_t *cond, std::nullptr_t) {
*cond = new std::condition_variable;
}
-inline void pthread_cond_signal(pthread_cond_t* cond) {
- (*cond)->notify_one();
-}
+inline void pthread_cond_signal(pthread_cond_t *cond) { (*cond)->notify_one(); }
inline void pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) {
std::unique_lock<std::mutex> lock(**mutex, std::adopt_lock);
(*cond)->wait(lock);
@@ -79,10 +67,8 @@ inline void pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) {
// the lock is not released
lock.release();
}
-inline void pthread_cond_destroy(pthread_cond_t *cond) {
- delete *cond;
-}
+inline void pthread_cond_destroy(pthread_cond_t *cond) { delete *cond; }
} // end namespace gemmlowp
#endif
-#endif // GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_ \ No newline at end of file
+#endif // GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_