[osal]: add time differ function

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@486 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-11-25 15:30:58 +00:00
parent 0c69cc591f
commit 1265c7f173
2 changed files with 17 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "mpp_log.h"
#include "mpp_time.h"
#if _WIN32
@@ -22,6 +23,9 @@
RK_S64 mpp_time()
{
if (!(mpp_debug & MPP_TIMING))
return 0;
struct timeb tb;
ftime(&tb);
return ((RK_S64)tb.time * 1000 + (RK_S64)tb.millitm) * 1000;
@@ -32,9 +36,21 @@ RK_S64 mpp_time()
RK_S64 mpp_time()
{
if (!(mpp_debug & MPP_TIMING))
return 0;
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(char *name, RK_S64 start, RK_S64 end)
{
if (!(mpp_debug & MPP_TIMING))
return;
mpp_dbg(MPP_TIMING, "%s %.1f\n ms", name, (start - end) / (float)1000);
}