4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 #include <asm/unistd.h>
26 #include "media-svc-debug.h"
28 #ifdef _PERFORMANCE_CHECK_
29 static long g_time_usec = 0L;
32 long mediainfo_get_debug_time(void)
34 #ifdef _PERFORMANCE_CHECK_
36 gettimeofday(&time, NULL);
37 return time.tv_sec * 1000000 + time.tv_usec;
43 void mediainfo_reset_debug_time(void)
45 #ifdef _PERFORMANCE_CHECK_
47 gettimeofday(&time, NULL);
48 g_time_usec = time.tv_sec * 1000000 + time.tv_usec;
52 void mediainfo_print_debug_time(char *time_string)
54 #ifdef _PERFORMANCE_CHECK_
56 double totaltime = 0.0;
58 gettimeofday(&time, NULL);
59 totaltime = (double)(time.tv_sec * 1000000 + time.tv_usec - g_time_usec) / CLOCKS_PER_SEC;
61 media_svc_debug("time [%s] : %f", time_string, totaltime);
66 mediainfo_print_debug_time_ex(long start, long end, const char *func_name, char *time_string)
68 #ifdef _PERFORMANCE_CHECK_
69 double totaltime = 0.0;
71 totaltime = (double)(end - start) / CLOCKS_PER_SEC;
73 media_svc_debug("time [%s: %s] : %f", func_name, time_string, totaltime);