mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 17:16:50 +08:00

It would be more easy to look into those code next time. The functions in mpp_time.c have removed the internal debug flag checking. Change-Id: I6392190896f74e86a8407f06fa3621dd92371e56 Signed-off-by: Randy Li <randy.li@rock-chips.com>
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
/*
|
|
* Copyright 2015 Rockchip Electronics Co. LTD
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#include "mpp_log.h"
|
|
#include "mpp_time.h"
|
|
|
|
#if _WIN32
|
|
#include <sys/types.h>
|
|
#include <sys/timeb.h>
|
|
|
|
RK_S64 mpp_time()
|
|
{
|
|
struct timeb tb;
|
|
ftime(&tb);
|
|
return ((RK_S64)tb.time * 1000 + (RK_S64)tb.millitm) * 1000;
|
|
}
|
|
|
|
#else
|
|
#include <sys/time.h>
|
|
|
|
RK_S64 mpp_time()
|
|
{
|
|
struct timeval tv_date;
|
|
gettimeofday(&tv_date, NULL);
|
|
return (RK_S64)tv_date.tv_sec * 1000000 + (RK_S64)tv_date.tv_usec;
|
|
}
|
|
|
|
#endif
|
|
|
|
void mpp_time_diff(RK_S64 start, RK_S64 end, RK_S64 limit, char *fmt)
|
|
{
|
|
RK_S64 diff = end - start;
|
|
if (diff >= limit)
|
|
mpp_dbg(MPP_DBG_TIMING, "%s timing %lld us\n", fmt, diff);
|
|
}
|
|
|