diff options
author | Alex Ray <aray@google.com> | 2013-10-14 15:56:43 -0700 |
---|---|---|
committer | Alex Ray <aray@google.com> | 2013-10-14 15:56:43 -0700 |
commit | ea80382be17ab288622506475b8f15d9d8ebee80 (patch) | |
tree | 39ec2a4f1c42749c8948a75c12d2087c9b27a5d3 /modules | |
parent | 13a47c595031ed926e8258945a08bfa96fdf9408 (diff) | |
download | hardware_libhardware-ea80382be17ab288622506475b8f15d9d8ebee80.zip hardware_libhardware-ea80382be17ab288622506475b8f15d9d8ebee80.tar.gz hardware_libhardware-ea80382be17ab288622506475b8f15d9d8ebee80.tar.bz2 |
modules: camera: Update trace headers to libutils
Now that libutils is outside of frameworks, use that for c++-style
scoped tracing and remove the temporary shim header.
Change-Id: I913767aed8ff70abb9299e7a7b318b24a25e23c1
Diffstat (limited to 'modules')
-rw-r--r-- | modules/camera/Android.mk | 1 | ||||
-rw-r--r-- | modules/camera/Camera.cpp | 11 | ||||
-rw-r--r-- | modules/camera/Metadata.cpp | 3 | ||||
-rw-r--r-- | modules/camera/ScopedTrace.h | 51 | ||||
-rw-r--r-- | modules/camera/Stream.cpp | 5 |
5 files changed, 9 insertions, 62 deletions
diff --git a/modules/camera/Android.mk b/modules/camera/Android.mk index e02a143..ba6852f 100644 --- a/modules/camera/Android.mk +++ b/modules/camera/Android.mk @@ -34,6 +34,7 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ libsync \ + libutils \ LOCAL_CFLAGS += -Wall -Wextra -fvisibility=hidden diff --git a/modules/camera/Camera.cpp b/modules/camera/Camera.cpp index 973380e..724f861 100644 --- a/modules/camera/Camera.cpp +++ b/modules/camera/Camera.cpp @@ -29,8 +29,7 @@ #include <cutils/log.h> #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL) -#include <cutils/trace.h> -#include "ScopedTrace.h" +#include <utils/Trace.h> #include "Camera.h" @@ -79,7 +78,7 @@ Camera::~Camera() int Camera::open(const hw_module_t *module, hw_device_t **device) { ALOGI("%s:%d: Opening camera device", __func__, mId); - CAMTRACE_CALL(); + ATRACE_CALL(); pthread_mutex_lock(&mMutex); if (mBusy) { pthread_mutex_unlock(&mMutex); @@ -116,7 +115,7 @@ int Camera::getInfo(struct camera_info *info) int Camera::close() { ALOGI("%s:%d: Closing camera device", __func__, mId); - CAMTRACE_CALL(); + ATRACE_CALL(); pthread_mutex_lock(&mMutex); if (!mBusy) { pthread_mutex_unlock(&mMutex); @@ -300,7 +299,7 @@ int Camera::configureStreams(camera3_stream_configuration_t *stream_config) camera3_stream_t *astream; Stream **newStreams = NULL; - CAMTRACE_CALL(); + ATRACE_CALL(); ALOGV("%s:%d: stream_config=%p", __func__, mId, stream_config); if (stream_config == NULL) { @@ -485,7 +484,7 @@ int Camera::processCaptureRequest(camera3_capture_request_t *request) camera3_capture_result result; ALOGV("%s:%d: request=%p", __func__, mId, request); - CAMTRACE_CALL(); + ATRACE_CALL(); if (request == NULL) { ALOGE("%s:%d: NULL request recieved", __func__, mId); diff --git a/modules/camera/Metadata.cpp b/modules/camera/Metadata.cpp index d5854f9..ba7ed9c 100644 --- a/modules/camera/Metadata.cpp +++ b/modules/camera/Metadata.cpp @@ -22,8 +22,7 @@ #include <cutils/log.h> #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL) -#include <cutils/trace.h> -#include "ScopedTrace.h" +#include <utils/Trace.h> #include "Metadata.h" diff --git a/modules/camera/ScopedTrace.h b/modules/camera/ScopedTrace.h deleted file mode 100644 index ed00570..0000000 --- a/modules/camera/ScopedTrace.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef CAMERA_SCOPED_TRACE_H -#define CAMERA_SCOPED_TRACE_H - -#include <stdint.h> -#include <cutils/trace.h> - -// See <cutils/trace.h> for more tracing macros. - -// CAMTRACE_NAME traces the beginning and end of the current scope. To trace -// the correct start and end times this macro should be declared first in the -// scope body. -#define CAMTRACE_NAME(name) ScopedTrace ___tracer(ATRACE_TAG, name) -// CAMTRACE_CALL is an ATRACE_NAME that uses the current function name. -#define CAMTRACE_CALL() CAMTRACE_NAME(__FUNCTION__) - -namespace default_camera_hal { - -class ScopedTrace { -public: -inline ScopedTrace(uint64_t tag, const char* name) - : mTag(tag) { - atrace_begin(mTag,name); -} - -inline ~ScopedTrace() { - atrace_end(mTag); -} - -private: - uint64_t mTag; -}; - -}; // namespace default_camera_hal - -#endif // CAMERA_SCOPED_TRACE_H diff --git a/modules/camera/Stream.cpp b/modules/camera/Stream.cpp index aae7adb..9c5c5b5 100644 --- a/modules/camera/Stream.cpp +++ b/modules/camera/Stream.cpp @@ -24,8 +24,7 @@ #include <cutils/log.h> #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL) -#include <cutils/trace.h> -#include "ScopedTrace.h" +#include <utils/Trace.h> #include "Stream.h" @@ -139,7 +138,7 @@ bool Stream::isValidReuseStream(int id, camera3_stream_t *s) int Stream::registerBuffers(const camera3_stream_buffer_set_t *buf_set) { - CAMTRACE_CALL(); + ATRACE_CALL(); if (buf_set->stream != mStream) { ALOGE("%s:%d: Buffer set for invalid stream. Got %p expect %p", |