Updating INI configuration file to work with most cameras.
[profile/ivi/camera.git] / include / cam_ta.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *        http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef _CAM_TA_H_
19 #define _CAM_TA_H_
20
21 #define ENABLE_TA
22 #ifdef ENABLE_TA
23 #define CAM_TA_MAX_CHECKPOINT   500
24 #define CAM_TA_MAX_ACCUM                500
25
26 typedef struct _cam_ta_checkpoint {
27         unsigned long timestamp;
28         char *name;
29 } cam_ta_checkpoint;
30
31 typedef struct _cam_ta_accum_item {
32         unsigned long elapsed_accum;
33         unsigned long num_calls;
34         unsigned long elapsed_min;
35         unsigned long elapsed_max;
36         unsigned long first_start;
37         unsigned long last_end;
38
39         char *name;
40
41         unsigned long timestamp;
42         int on_estimate;
43         int num_unpair;
44 } cam_ta_accum_item;
45
46 #define CAM_TA_SHOW_STDOUT      0
47 #define CAM_TA_SHOW_STDERR      1
48 #define CAM_TA_SHOW_FILE        2
49 #define CAM_TA_RESULT_FILE "/tmp/cam-ta.log"
50
51 int cam_ta_init(void);
52 int cam_ta_release(void);
53 void cam_ta_set_enable(int enable);
54 char *cam_ta_fmt(const char *fmt, ...);
55
56 int cam_ta_add_checkpoint(char *name, int show, char *filename, int line);
57 void cam_ta_show_checkpoints(void);
58 void cam_ta_show_diff(char *name1, char *name2);
59
60 int cam_ta_get_numof_checkpoints();
61 unsigned long cam_ta_get_diff(char *name1, char *name2);
62 char *cam_ta_get_name(int idx);
63
64 int cam_ta_accum_item_begin(char *name, int show, char *filename, int line);
65 int cam_ta_accum_item_end(char *name, int show, char *filename, int line);
66 void cam_ta_accum_show_result(int direction);
67
68 #define CAM_TA_INIT()                                                           (cam_ta_init())
69 #define CAM_TA_RELEASE()                                                        (cam_ta_release())
70 #define CAM_TA_SET_ENABLE(enable)                                       (cam_ta_set_enable(enable))
71
72 #define CAM_TA_ADD_CHECKPOINT(name, show)               (cam_ta_add_checkpoint(name, show, __FILE__, __LINE__))
73 #define CAM_TA_SHOW_CHECKPOINTS()                               (cam_ta_show_checkpoints())
74 #define CAM_TA_SHOW_DIFF(name1, name2)                  (cam_ta_show_diff(name1, name2))
75 #define CAM_TA_GET_NUMOF_CHECKPOINTS()                  (cam_ta_get_numof_checkpoints())
76 #define CAM_TA_GET_DIFF(name1, name2)                           (cam_ta_get_diff(name1, name2))
77 #define CAM_TA_GET_NAME(idx)                                            (cam_ta_get_name(idx))
78
79 #define CAM_TA_ACUM_ITEM_BEGIN(name, show)              (cam_ta_accum_item_begin(name, show, __FILE__, __LINE__))
80 #define CAM_TA_ACUM_ITEM_END(name, show)                        (cam_ta_accum_item_end(name, show, __FILE__, __LINE__))
81 #define CAM_TA_ACUM_ITEM_SHOW_RESULT()                  (cam_ta_accum_show_result(CAM_TA_SHOW_STDOUT))
82 #define CAM_TA_ACUM_ITEM_SHOW_RESULT_TO(x)              (cam_ta_accum_show_result(x))
83
84 #define __cam_ta__(name, x) \
85 CAM_TA_ACUM_ITEM_BEGIN(name, 0); \
86 x \
87 CAM_TA_ACUM_ITEM_END(name, 0);
88
89 #define __cam_tafmt__(fmt, args...)                     (cam_ta_fmt(fmt, ##args))
90
91 #else
92
93 #define CAM_TA_INIT()
94 #define CAM_TA_RELEASE()
95 #define CAM_TA_SET_ENABLE(enable)
96
97 #define CAM_TA_ADD_CHECKPOINT(name, show)
98 #define CAM_TA_SHOW_CHECKPOINTS()
99 #define CAM_TA_SHOW_DIFF(name1, name2)
100 #define CAM_TA_GET_NUMOF_CHECKPOINTS()
101 #define CAM_TA_GET_DIFF(name1, name2)
102 #define CAM_TA_GET_NAME(idx)
103
104 #define CAM_TA_ACUM_ITEM_BEGIN(name, show)
105 #define CAM_TA_ACUM_ITEM_END(name, show)
106 #define CAM_TA_ACUM_ITEM_SHOW_RESULT()
107 #define CAM_TA_ACUM_ITEM_SHOW_RESULT_TO(x)
108 #define __cam_ta__(name, x) x
109 #define __cam_tafmt__(fmt, args...)
110
111 #endif
112 #endif