summaryrefslogtreecommitdiffstats
path: root/modules/camera
diff options
context:
space:
mode:
authorAlex Ray <aray@google.com>2012-12-27 10:42:22 -0800
committerAlex Ray <aray@google.com>2013-01-03 21:06:27 -0800
commited6b8a771038acdb08a6c55abfe563d75acb63fa (patch)
treeae83441f974f7557bf724516dd58c6d86aeb5379 /modules/camera
parenta48dd3fb34ac5b83bd397f53833f6dcc3469df76 (diff)
downloadhardware_libhardware-ed6b8a771038acdb08a6c55abfe563d75acb63fa.zip
hardware_libhardware-ed6b8a771038acdb08a6c55abfe563d75acb63fa.tar.gz
hardware_libhardware-ed6b8a771038acdb08a6c55abfe563d75acb63fa.tar.bz2
modules: camera: Add tracing
Change-Id: I00ee447e6b57bc57fd09b6e7d8c62cb07cb37cf0
Diffstat (limited to 'modules/camera')
-rw-r--r--modules/camera/Android.mk2
-rw-r--r--modules/camera/Camera.cpp14
2 files changed, 15 insertions, 1 deletions
diff --git a/modules/camera/Android.mk b/modules/camera/Android.mk
index aa457f4..44d7212 100644
--- a/modules/camera/Android.mk
+++ b/modules/camera/Android.mk
@@ -20,6 +20,7 @@ LOCAL_MODULE := camera.default
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_C_INCLUDES += \
+ system/core/include \
system/media/camera/include \
LOCAL_SRC_FILES := \
@@ -28,6 +29,7 @@ LOCAL_SRC_FILES := \
LOCAL_SHARED_LIBRARIES := \
libcamera_metadata \
+ libcutils \
liblog \
LOCAL_CFLAGS += -Wall -Wextra
diff --git a/modules/camera/Camera.cpp b/modules/camera/Camera.cpp
index 24cfe4f..6ae0a5d 100644
--- a/modules/camera/Camera.cpp
+++ b/modules/camera/Camera.cpp
@@ -17,10 +17,13 @@
#include <cstdlib>
#include <pthread.h>
-#define LOG_NDEBUG 0
+//#define LOG_NDEBUG 0
#define LOG_TAG "Camera"
#include <cutils/log.h>
+#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
+#include <cutils/trace.h>
+
#include "Camera.h"
namespace default_camera_hal {
@@ -57,9 +60,11 @@ Camera::~Camera()
int Camera::open()
{
ALOGV("%s: camera id %d", __func__, mId);
+ ATRACE_BEGIN("open");
pthread_mutex_lock(&mMutex);
if (mBusy) {
pthread_mutex_unlock(&mMutex);
+ ATRACE_END();
ALOGE("%s:id%d: Error, device already in use.", __func__, mId);
return -EBUSY;
}
@@ -68,15 +73,18 @@ int Camera::open()
mBusy = true;
pthread_mutex_unlock(&mMutex);
+ ATRACE_END();
return 0;
}
int Camera::close()
{
ALOGV("%s: camera id %d", __func__, mId);
+ ATRACE_BEGIN("close");
pthread_mutex_lock(&mMutex);
if (!mBusy) {
pthread_mutex_unlock(&mMutex);
+ ATRACE_END();
ALOGE("%s:id%d: Error, close() on not open device.", __func__, mId);
return -EINVAL;
}
@@ -85,6 +93,7 @@ int Camera::close()
mBusy = false;
pthread_mutex_unlock(&mMutex);
+ ATRACE_END();
return 0;
}
@@ -105,9 +114,11 @@ int Camera::getCameraInfo(struct camera_info* info)
void Camera::init()
{
+ ATRACE_BEGIN("init");
pthread_mutex_lock(&mMutex);
if (mMetadata != NULL) {
pthread_mutex_unlock(&mMutex);
+ ATRACE_END();
return;
}
@@ -115,6 +126,7 @@ void Camera::init()
mMetadata = allocate_camera_metadata(1,1);
pthread_mutex_unlock(&mMutex);
+ ATRACE_END();
}
} // namespace default_camera_hal