diff options
author | Prateek Chaubey <chaubeyprateek@gmail.com> | 2018-01-07 20:55:14 +0530 |
---|---|---|
committer | Davide Garberi <dade.garberi@gmail.com> | 2018-01-19 14:09:15 +0100 |
commit | 6616278131edd80a12545085e06ee6b0e0a0a788 (patch) | |
tree | 0aef88ed11809a9d67f6abe4dc2ff782a14737e2 /camera/QCamera2/util/QCameraTrace.h | |
parent | cc4ccf34871da343111bf68d16ba4e4c67cac1dc (diff) |
msm8996-common: zuk: Import OSS Camera HAL
Tag: LA.HB.1.3.2-32600-8x96.0
Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
Diffstat (limited to 'camera/QCamera2/util/QCameraTrace.h')
-rw-r--r-- | camera/QCamera2/util/QCameraTrace.h | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/camera/QCamera2/util/QCameraTrace.h b/camera/QCamera2/util/QCameraTrace.h new file mode 100644 index 0000000..d7eeb8f --- /dev/null +++ b/camera/QCamera2/util/QCameraTrace.h @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * Not a Contribution. + * + * Copyright (C) 2012 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 __QCAMERATRACE_H__ +#define __QCAMERATRACE_H__ + +#include <utils/Trace.h> + +#ifdef QCAMERA_REDEFINE_LOG +#define CAM_MODULE CAM_HAL_MODULE +extern "C" { +#include "mm_camera_dbg.h" +} +#endif + +#undef ATRACE_CALL +#undef ATRACE_NAME +#undef ATRACE_BEGIN +#undef ATRACE_INT +#undef ATRACE_END +#undef ATRACE_BEGIN_SNPRINTF +#undef KPI_ATRACE_BEGIN +#undef KPI_ATRACE_END +#undef KPI_ATRACE_INT +#undef ATRACE_TAG +#undef ATRACE_BEGIN_DBG +#undef ATRACE_INT_DBG +#undef ATRACE_END_DBG + +#define KPI_ONLY 1 +#define KPI_DBG 2 + +#define CAMERA_TRACE_BUF 32 + +#define ATRACE_TAG ATRACE_TAG_CAMERA + +//to enable only KPI logs +#define KPI_ATRACE_BEGIN(name) ({\ +if (gKpiDebugLevel >= KPI_ONLY) { \ + atrace_begin(ATRACE_TAG, name); \ +}\ +}) + +#define KPI_ATRACE_END() ({\ +if (gKpiDebugLevel >= KPI_ONLY) { \ + atrace_end(ATRACE_TAG); \ +}\ +}) + +#define KPI_ATRACE_INT(name,val) ({\ +if (gKpiDebugLevel >= KPI_ONLY) { \ + atrace_int(ATRACE_TAG, name, val); \ +}\ +}) + + +#define ATRACE_BEGIN_SNPRINTF(fmt_str, ...) \ + if (gKpiDebugLevel >= KPI_DBG) { \ + char trace_tag[CAMERA_TRACE_BUF]; \ + snprintf(trace_tag, CAMERA_TRACE_BUF, fmt_str, ##__VA_ARGS__); \ + ATRACE_BEGIN(trace_tag); \ +} + +#define ATRACE_BEGIN_DBG(name) ({\ +if (gKpiDebugLevel >= KPI_DBG) { \ + atrace_begin(ATRACE_TAG, name); \ +}\ +}) + +#define ATRACE_END_DBG() ({\ +if (gKpiDebugLevel >= KPI_DBG) { \ + atrace_end(ATRACE_TAG); \ +}\ +}) + +#define ATRACE_INT_DBG(name,val) ({\ +if (gKpiDebugLevel >= KPI_DBG) { \ + atrace_int(ATRACE_TAG, name, val); \ +}\ +}) + +#define ATRACE_BEGIN ATRACE_BEGIN_DBG +#define ATRACE_INT ATRACE_INT_DBG +#define ATRACE_END ATRACE_END_DBG + +#define KPI_ATRACE_NAME(name) qcamera::ScopedTraceKpi ___tracer(ATRACE_TAG, name) +#define ATRACE_NAME(name) qcamera::ScopedTraceDbg ___tracer(ATRACE_TAG, name) +#define KPI_ATRACE_CALL() KPI_ATRACE_NAME(__FUNCTION__) +#define ATRACE_CALL() ATRACE_NAME(__FUNCTION__) + +namespace qcamera { +extern volatile uint32_t gKpiDebugLevel; +class ScopedTraceKpi { +public: + inline ScopedTraceKpi(uint64_t tag, const char *name) + : mTag(tag) { + if (gKpiDebugLevel >= KPI_ONLY) { + atrace_begin(mTag,name); + } + } + + inline ~ScopedTraceKpi() { + if (gKpiDebugLevel >= KPI_ONLY) { + atrace_end(mTag); + } + } + + private: + uint64_t mTag; +}; + +class ScopedTraceDbg { +public: + inline ScopedTraceDbg(uint64_t tag, const char *name) + : mTag(tag) { + if (gKpiDebugLevel >= KPI_DBG) { + atrace_begin(mTag,name); + } + } + + inline ~ScopedTraceDbg() { + if (gKpiDebugLevel >= KPI_DBG) { + atrace_end(mTag); + } + } + + private: + uint64_t mTag; +}; +}; + +extern volatile uint32_t gKpiDebugLevel; + +#endif /* __QCAMREATRACE_H__ */ |