mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[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:
@@ -35,6 +35,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
RK_S64 mpp_time();
|
RK_S64 mpp_time();
|
||||||
|
void mpp_time_diff(char *name, RK_S64 start, RK_S64 end);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "mpp_log.h"
|
||||||
#include "mpp_time.h"
|
#include "mpp_time.h"
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
@@ -22,6 +23,9 @@
|
|||||||
|
|
||||||
RK_S64 mpp_time()
|
RK_S64 mpp_time()
|
||||||
{
|
{
|
||||||
|
if (!(mpp_debug & MPP_TIMING))
|
||||||
|
return 0;
|
||||||
|
|
||||||
struct timeb tb;
|
struct timeb tb;
|
||||||
ftime(&tb);
|
ftime(&tb);
|
||||||
return ((RK_S64)tb.time * 1000 + (RK_S64)tb.millitm) * 1000;
|
return ((RK_S64)tb.time * 1000 + (RK_S64)tb.millitm) * 1000;
|
||||||
@@ -32,9 +36,21 @@ RK_S64 mpp_time()
|
|||||||
|
|
||||||
RK_S64 mpp_time()
|
RK_S64 mpp_time()
|
||||||
{
|
{
|
||||||
|
if (!(mpp_debug & MPP_TIMING))
|
||||||
|
return 0;
|
||||||
|
|
||||||
struct timeval tv_date;
|
struct timeval tv_date;
|
||||||
gettimeofday(&tv_date, NULL);
|
gettimeofday(&tv_date, NULL);
|
||||||
return (RK_S64)tv_date.tv_sec * 1000000 + (RK_S64)tv_date.tv_usec;
|
return (RK_S64)tv_date.tv_sec * 1000000 + (RK_S64)tv_date.tv_usec;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user