[osal]: rename mpp_malloc to mpp_mem, add mpp_time function

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@63 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming 2015-08-07 10:15:24 +00:00
parent 3a922a1ba0
commit c35cc7d345
7 changed files with 82 additions and 3 deletions

View file

@ -13,6 +13,7 @@ include_directories(.)
add_library(osal STATIC
mpp_malloc.cpp
mpp_time.cpp
mpp_list.cpp
mpp_env.cpp
mpp_log.cpp

View file

@ -41,5 +41,10 @@ void mpp_osal_free(void *ptr);
}
#endif
// buffer manipulation function
#if defined(_WIN32)
#define snprintf _snprintf
#endif
#endif /*__MPP_MALLOC_H__*/

33
osal/inc/mpp_time.h Normal file
View file

@ -0,0 +1,33 @@
/*
* Copyright 2010 Rockchip Electronics S.LSI 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.
*/
#ifndef __MPP_COMMON_H__
#define __MPP_COMMON_H__
#include "rk_type.h"
#ifdef __cplusplus
extern "C" {
#endif
RK_S64 mpp_time();
#ifdef __cplusplus
}
#endif
#endif /*__MPP_COMMON_H__*/

View file

@ -23,7 +23,7 @@
#include "mpp_log.h"
#include "mpp_env.h"
#include "mpp_malloc.h"
#include "mpp_mem.h"
#include "mpp_list.h"
#include "os_malloc.h"

40
osal/mpp_time.cpp Normal file
View file

@ -0,0 +1,40 @@
/*
* Copyright 2010 Rockchip Electronics S.LSI 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_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

View file

@ -25,7 +25,7 @@ add_mpp_osal_test(mpp_log)
add_mpp_osal_test(mpp_env)
# malloc system unit test
add_mpp_osal_test(mpp_malloc)
add_mpp_osal_test(mpp_mem)
# thread implement unit test
add_mpp_osal_test(mpp_thread)

View file

@ -18,7 +18,7 @@
#include "mpp_log.h"
#include "mpp_env.h"
#include "mpp_malloc.h"
#include "mpp_mem.h"
// TODO: need to add pressure test case and parameter scan case